Skip to content

Commit 75ff841

Browse files
committed
Fix isoformat calls in date parsing tests to include timespec
1 parent 99e7235 commit 75ff841

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

test/test_datetime.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,40 +18,48 @@
1818
class TestGetDateFromString(unittest.TestCase):
1919
def test_happy_dd_mm_yyyy(self):
2020
self.assertEqual(
21-
get_date_from_string("2006-05-04").isoformat(), "2006-05-04T00:00:00"
21+
get_date_from_string("2006-05-04").isoformat(timespec="seconds"),
22+
"2006-05-04T00:00:00",
2223
)
2324

2425
def test_happy_mm_yyyy(self):
2526
self.assertEqual(
26-
get_date_from_string("2006-05").isoformat(), "2006-05-01T00:00:00"
27+
get_date_from_string("2006-05").isoformat(timespec="seconds"),
28+
"2006-05-01T00:00:00",
2729
)
2830

2931
def test_happy_yyyy(self):
3032
self.assertEqual(
31-
get_date_from_string("2006").isoformat(), "2006-01-01T00:00:00"
33+
get_date_from_string("2006").isoformat(timespec="seconds"),
34+
"2006-01-01T00:00:00",
3235
)
3336

3437
def test_happy_iso_8601(self):
3538
self.assertEqual(
36-
get_date_from_string("2006-05-04T01:02:03Z").isoformat(),
39+
get_date_from_string("2006-05-04T01:02:03Z").isoformat(timespec="seconds"),
3740
"2006-05-04T01:02:03+00:00",
3841
)
3942

4043
def test_happy_iso_8601_microseconds(self):
4144
self.assertEqual(
42-
get_date_from_string("2006-05-04T01:02:03.999Z").isoformat(),
45+
get_date_from_string("2006-05-04T01:02:03.999Z").isoformat(
46+
timespec="microseconds"
47+
),
4348
"2006-05-04T01:02:03.999000+00:00",
4449
)
4550

4651
def test_happy_iso_8601_timezone(self):
4752
self.assertEqual(
48-
get_date_from_string("2006-05-04T01:02:03+0100").isoformat(),
53+
get_date_from_string("2006-05-04T01:02:03+0100").isoformat(
54+
timespec="seconds"
55+
),
4956
"2006-05-04T01:02:03+01:00",
5057
)
5158

5259
def test_happy_iso_8601_plain(self):
5360
self.assertEqual(
54-
get_date_from_string("1000").isoformat(), "1000-01-01T00:00:00"
61+
get_date_from_string("1000").isoformat(timespec="seconds"),
62+
"1000-01-01T00:00:00",
5563
)
5664

5765
def test_unhappy_invalid_day(self):

0 commit comments

Comments
 (0)