Add missing space
This commit is contained in:
parent
4973582bdf
commit
974deeafaa
|
@ -281,7 +281,7 @@ class TradingTime(models.Model):
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return (
|
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})"
|
f"{self.get_end_day_display()} at {self.end_time})"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
from django.test import TestCase
|
|
||||||
from core.models import TradingTime, User
|
|
||||||
from datetime import datetime, time
|
from datetime import datetime, time
|
||||||
|
|
||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
from core.models import TradingTime, User
|
||||||
|
|
||||||
|
|
||||||
class MarketTestCase(TestCase):
|
class MarketTestCase(TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
# Create a test user
|
# Create a test user
|
||||||
|
@ -22,11 +25,11 @@ class MarketTestCase(TestCase):
|
||||||
test_time = datetime(2022, 11, 28, 10, 0, 0)
|
test_time = datetime(2022, 11, 28, 10, 0, 0)
|
||||||
|
|
||||||
trading_time = TradingTime.objects.create(
|
trading_time = TradingTime.objects.create(
|
||||||
user = self.user,
|
user=self.user,
|
||||||
start_day = 1,
|
start_day=1,
|
||||||
end_day = 1,
|
end_day=1,
|
||||||
start_time = self.time_9,
|
start_time=self.time_9,
|
||||||
end_time = self.time_11,
|
end_time=self.time_11,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertTrue(trading_time.within_range(test_time))
|
self.assertTrue(trading_time.within_range(test_time))
|
||||||
|
@ -38,11 +41,11 @@ class MarketTestCase(TestCase):
|
||||||
"""
|
"""
|
||||||
test_time = datetime(2022, 11, 28, 10, 0, 0)
|
test_time = datetime(2022, 11, 28, 10, 0, 0)
|
||||||
trading_time = TradingTime.objects.create(
|
trading_time = TradingTime.objects.create(
|
||||||
user = self.user,
|
user=self.user,
|
||||||
start_day = 1,
|
start_day=1,
|
||||||
end_day = 1,
|
end_day=1,
|
||||||
start_time = self.time_14,
|
start_time=self.time_14,
|
||||||
end_time = self.time_16,
|
end_time=self.time_16,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertFalse(trading_time.within_range(test_time))
|
self.assertFalse(trading_time.within_range(test_time))
|
||||||
|
@ -51,11 +54,11 @@ class MarketTestCase(TestCase):
|
||||||
test_time = datetime(2022, 11, 28, 20, 0, 0)
|
test_time = datetime(2022, 11, 28, 20, 0, 0)
|
||||||
|
|
||||||
trading_time = TradingTime.objects.create(
|
trading_time = TradingTime.objects.create(
|
||||||
user = self.user,
|
user=self.user,
|
||||||
start_day = 1, # Monday
|
start_day=1, # Monday
|
||||||
end_day = 6, # Saturday
|
end_day=6, # Saturday
|
||||||
start_time = self.time_9,
|
start_time=self.time_9,
|
||||||
end_time = self.time_11,
|
end_time=self.time_11,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertTrue(trading_time.within_range(test_time))
|
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
|
# Set test time Monday, 28 November, 2022, 13:00:00
|
||||||
test_time = datetime(2022, 11, 28, 13, 0, 0)
|
test_time = datetime(2022, 11, 28, 13, 0, 0)
|
||||||
trading_time = TradingTime.objects.create(
|
trading_time = TradingTime.objects.create(
|
||||||
user = self.user,
|
user=self.user,
|
||||||
start_day = 1,
|
start_day=1,
|
||||||
end_day = 6,
|
end_day=6,
|
||||||
start_time = self.time_14,
|
start_time=self.time_14,
|
||||||
end_time = self.time_16,
|
end_time=self.time_16,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertFalse(trading_time.within_range(test_time))
|
self.assertFalse(trading_time.within_range(test_time))
|
||||||
|
@ -80,11 +83,11 @@ class MarketTestCase(TestCase):
|
||||||
test_time = datetime(2022, 11, 29, 8, 0, 0)
|
test_time = datetime(2022, 11, 29, 8, 0, 0)
|
||||||
|
|
||||||
trading_time = TradingTime.objects.create(
|
trading_time = TradingTime.objects.create(
|
||||||
user = self.user,
|
user=self.user,
|
||||||
start_day = 2, # Tuesday
|
start_day=2, # Tuesday
|
||||||
end_day = 6,
|
end_day=6,
|
||||||
start_time = self.time_9,
|
start_time=self.time_9,
|
||||||
end_time = self.time_11,
|
end_time=self.time_11,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertFalse(trading_time.within_range(test_time))
|
self.assertFalse(trading_time.within_range(test_time))
|
Loading…
Reference in New Issue