@@ -3633,8 +3633,6 @@ def test_fromisoformat_datetime_examples(self):
36333633 self .theclass (2025 , 1 , 2 , 3 , 4 , 5 , 678901 )),
36343634 ('2009-04-19T03:15:45.2345' ,
36353635 self .theclass (2009 , 4 , 19 , 3 , 15 , 45 , 234500 )),
3636- ('2009-04-19T03:15:45.1234567' ,
3637- self .theclass (2009 , 4 , 19 , 3 , 15 , 45 , 123456 )),
36383636 ('2025-01-02T03:04:05,678' ,
36393637 self .theclass (2025 , 1 , 2 , 3 , 4 , 5 , 678000 )),
36403638 ('20250102' , self .theclass (2025 , 1 , 2 , 0 , 0 )),
@@ -3735,6 +3733,18 @@ def test_fromisoformat_datetime_examples(self):
37353733 ('2025-12-31T24:00:00' , self .theclass (2026 , 1 , 1 , 0 , 0 , 0 ))
37363734 ]
37373735
3736+
3737+ if '_Fast' in self .__class__ .__name__ :
3738+ examples += [
3739+ ('2009-04-19T03:15:45.1234567' ,
3740+ self .theclass (2009 , 4 , 19 , 3 , 15 , 45 , 123456 )),
3741+ ]
3742+ else :
3743+ examples += [
3744+ ('2009-04-19T03:15:45.1234567' ,
3745+ self .theclass (2009 , 4 , 19 , 3 , 15 , 45 , nanosecond = 123456700 )),
3746+ ]
3747+
37383748 for input_str , expected in examples :
37393749 with self .subTest (input_str = input_str ):
37403750 actual = self .theclass .fromisoformat (input_str )
@@ -4932,12 +4942,24 @@ def test_fromisoformat_fractions(self):
49324942 ('12:30:45.1234' , (12 , 30 , 45 , 123400 )),
49334943 ('12:30:45.12345' , (12 , 30 , 45 , 123450 )),
49344944 ('12:30:45.123456' , (12 , 30 , 45 , 123456 )),
4935- ('12:30:45.1234567' , (12 , 30 , 45 , 123456 )),
4936- ('12:30:45.12345678' , (12 , 30 , 45 , 123456 )),
49374945 ]
49384946
4947+ if '_Fast' in self .__class__ .__name__ :
4948+ strs += [
4949+ ('12:30:45.1234567' , (12 , 30 , 45 , 123456 )),
4950+ ('12:30:45.12345678' , (12 , 30 , 45 , 123456 )),
4951+ ]
4952+ else :
4953+ strs += [
4954+ ('12:30:45.1234567' , (12 , 30 , 45 , 123456.7 )),
4955+ ('12:30:45.12345678' , (12 , 30 , 45 , 123456.78 )),
4956+ ]
4957+
49394958 for time_str , time_comps in strs :
4940- expected = self .theclass (* time_comps )
4959+ if isinstance (time_comps [- 1 ], float ):
4960+ expected = self .theclass (* time_comps [:- 1 ], nanosecond = int (time_comps [- 1 ] * 1000 ))
4961+ else :
4962+ expected = self .theclass (* time_comps )
49414963 actual = self .theclass .fromisoformat (time_str )
49424964
49434965 self .assertEqual (actual , expected )
0 commit comments