Add missing space

This commit is contained in:
Mark Veidemanis 2022-11-25 22:15:27 +00:00
parent 4973582bdf
commit 974deeafaa
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
2 changed files with 32 additions and 29 deletions

View File

@ -281,7 +281,7 @@ class TradingTime(models.Model):
def __str__(self):
return (
f"{self.name} ({self.get_start_day_display()} at {self.start_time} -"
f"{self.name} ({self.get_start_day_display()} at {self.start_time} - "
f"{self.get_end_day_display()} at {self.end_time})"
)

View File

@ -1,7 +1,10 @@
from django.test import TestCase
from core.models import TradingTime, User
from datetime import datetime, time
from django.test import TestCase
from core.models import TradingTime, User
class MarketTestCase(TestCase):
def setUp(self):
# Create a test user
@ -22,11 +25,11 @@ class MarketTestCase(TestCase):
test_time = datetime(2022, 11, 28, 10, 0, 0)
trading_time = TradingTime.objects.create(
user = self.user,
start_day = 1,
end_day = 1,
start_time = self.time_9,
end_time = self.time_11,
user=self.user,
start_day=1,
end_day=1,
start_time=self.time_9,
end_time=self.time_11,
)
self.assertTrue(trading_time.within_range(test_time))
@ -38,11 +41,11 @@ class MarketTestCase(TestCase):
"""
test_time = datetime(2022, 11, 28, 10, 0, 0)
trading_time = TradingTime.objects.create(
user = self.user,
start_day = 1,
end_day = 1,
start_time = self.time_14,
end_time = self.time_16,
user=self.user,
start_day=1,
end_day=1,
start_time=self.time_14,
end_time=self.time_16,
)
self.assertFalse(trading_time.within_range(test_time))
@ -51,11 +54,11 @@ class MarketTestCase(TestCase):
test_time = datetime(2022, 11, 28, 20, 0, 0)
trading_time = TradingTime.objects.create(
user = self.user,
start_day = 1, # Monday
end_day = 6, # Saturday
start_time = self.time_9,
end_time = self.time_11,
user=self.user,
start_day=1, # Monday
end_day=6, # Saturday
start_time=self.time_9,
end_time=self.time_11,
)
self.assertTrue(trading_time.within_range(test_time))
@ -64,11 +67,11 @@ class MarketTestCase(TestCase):
# Set test time Monday, 28 November, 2022, 13:00:00
test_time = datetime(2022, 11, 28, 13, 0, 0)
trading_time = TradingTime.objects.create(
user = self.user,
start_day = 1,
end_day = 6,
start_time = self.time_14,
end_time = self.time_16,
user=self.user,
start_day=1,
end_day=6,
start_time=self.time_14,
end_time=self.time_16,
)
self.assertFalse(trading_time.within_range(test_time))
@ -80,11 +83,11 @@ class MarketTestCase(TestCase):
test_time = datetime(2022, 11, 29, 8, 0, 0)
trading_time = TradingTime.objects.create(
user = self.user,
start_day = 2, # Tuesday
end_day = 6,
start_time = self.time_9,
end_time = self.time_11,
user=self.user,
start_day=2, # Tuesday
end_day=6,
start_time=self.time_9,
end_time=self.time_11,
)
self.assertFalse(trading_time.within_range(test_time))