Skip to content

Commit

Permalink
fix localize test
Browse files Browse the repository at this point in the history
  • Loading branch information
deniszh committed Aug 25, 2024
1 parent da6ea8c commit a0ad0f4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions webapp/tests/test_attime.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ATTimeTimezoneTests(TestCase):

def test_should_return_absolute_time(self):
time_string = '12:0020150308'
expected_time = self.default_tz.localize(datetime.strptime(time_string,'%H:%M%Y%m%d'))
expected_time = pytz.timezone(str(self.default_tz)).localize(datetime.strptime("11:00_20171013", '%H:%M_%Y%m%d'))
actual_time = parseATTime(time_string)
self.assertEqual(actual_time, expected_time)

Expand All @@ -43,7 +43,7 @@ def test_absolute_time_should_respect_tz(self):

def test_should_return_absolute_time_short(self):
time_string = '9:0020150308'
expected_time = self.default_tz.localize(datetime.strptime(time_string,'%H:%M%Y%m%d'))
expected_time = pytz.timezone(str(self.default_tz)).localize(datetime.strptime(time_string,'%H:%M%Y%m%d'))
actual_time = parseATTime(time_string)
self.assertEqual(actual_time, expected_time)

Expand Down Expand Up @@ -80,7 +80,7 @@ def test_relative_day_and_offset_with_tz(self):
self.assertEqual(actual_time, expected_time)

def test_should_return_current_time(self):
expected_time = self.default_tz.localize(datetime.strptime("12:00_20150308", '%H:%M_%Y%m%d'))
expected_time = pytz.timezone(str(self.default_tz)).localize(datetime.strptime("12:00_20150308", '%H:%M_%Y%m%d'))
actual_time = parseATTime("now")
self.assertEqual(actual_time, expected_time)

Expand Down Expand Up @@ -465,7 +465,7 @@ class parseATTimeTestNow(TestCase):

def test_should_return_absolute_time(self):
time_string = '12:0020150308'
expected_time = self.default_tz.localize(datetime.strptime(time_string,'%H:%M%Y%m%d'))
expected_time = pytz.timezone(str(self.default_tz)).localize(datetime.strptime(time_string,'%H:%M%Y%m%d'))
actual_time = parseATTime(time_string, now=self.now)
self.assertEqual(actual_time, expected_time)

Expand All @@ -477,7 +477,7 @@ def test_absolute_time_should_respect_tz(self):

def test_should_return_absolute_time_short(self):
time_string = '9:0020150308'
expected_time = self.default_tz.localize(datetime.strptime(time_string,'%H:%M%Y%m%d'))
expected_time = pytz.timezone(str(self.default_tz)).localize(datetime.strptime(time_string,'%H:%M%Y%m%d'))
actual_time = parseATTime(time_string, now=self.now)
self.assertEqual(actual_time, expected_time)

Expand Down Expand Up @@ -514,7 +514,7 @@ def test_relative_day_and_offset_with_tz(self):
self.assertEqual(actual_time, expected_time)

def test_should_return_current_time(self):
expected_time = self.default_tz.localize(datetime.strptime("11:00_20171013", '%H:%M_%Y%m%d'))
expected_time = pytz.timezone(str(self.default_tz)).localize(datetime.strptime("11:00_20171013", '%H:%M_%Y%m%d'))
actual_time = parseATTime("now", now=self.now)
self.assertEqual(actual_time, expected_time)

Expand Down

0 comments on commit a0ad0f4

Please sign in to comment.