diff --git a/core/models.py b/core/models.py index 16717bc..37c18cd 100644 --- a/core/models.py +++ b/core/models.py @@ -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})" ) diff --git a/core/tests/lib/test_market.py b/core/tests/lib/test_market.py index b6e154b..1a0423a 100644 --- a/core/tests/lib/test_market.py +++ b/core/tests/lib/test_market.py @@ -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)) \ No newline at end of file + self.assertFalse(trading_time.within_range(test_time))