|
18 | 18 | class TestGetDateFromString(unittest.TestCase): |
19 | 19 | def test_happy_dd_mm_yyyy(self): |
20 | 20 | 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", |
22 | 23 | ) |
23 | 24 |
|
24 | 25 | def test_happy_mm_yyyy(self): |
25 | 26 | 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", |
27 | 29 | ) |
28 | 30 |
|
29 | 31 | def test_happy_yyyy(self): |
30 | 32 | 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", |
32 | 35 | ) |
33 | 36 |
|
34 | 37 | def test_happy_iso_8601(self): |
35 | 38 | 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"), |
37 | 40 | "2006-05-04T01:02:03+00:00", |
38 | 41 | ) |
39 | 42 |
|
40 | 43 | def test_happy_iso_8601_microseconds(self): |
41 | 44 | 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 | + ), |
43 | 48 | "2006-05-04T01:02:03.999000+00:00", |
44 | 49 | ) |
45 | 50 |
|
46 | 51 | def test_happy_iso_8601_timezone(self): |
47 | 52 | 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 | + ), |
49 | 56 | "2006-05-04T01:02:03+01:00", |
50 | 57 | ) |
51 | 58 |
|
52 | 59 | def test_happy_iso_8601_plain(self): |
53 | 60 | 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", |
55 | 63 | ) |
56 | 64 |
|
57 | 65 | def test_unhappy_invalid_day(self): |
|
0 commit comments