Skip to content

Commit 2e2ccf4

Browse files
Add test
1 parent 87c8627 commit 2e2ccf4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Lib/test/datetimetester.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3112,6 +3112,12 @@ def test_strptime_z_empty(self):
31123112
result = self.theclass.strptime(string, format)
31133113
self.assertEqual(result, target)
31143114

3115+
def test_strptime_conflicting_directives(self):
3116+
# gh-124549: warn when using conflicting directives
3117+
with self.assertWarns(SyntaxWarning) as cm:
3118+
self.theclass.strptime("2025 26", "%Y %y")
3119+
self.assertIn("conflicting directives", str(cm.warning))
3120+
31153121
def test_more_timetuple(self):
31163122
# This tests fields beyond those tested by the TestDate.test_timetuple.
31173123
t = self.theclass(2004, 12, 31, 6, 22, 33)

0 commit comments

Comments
 (0)