mirror of
https://github.com/python/cpython.git
synced 2025-08-02 16:13:13 +00:00
[3.13] gh-117655: Prevent test_strptime
from raising a DeprecationWarning (GH-117668) (GH-118956)
gh-117655: Prevent `test_strptime` from raising a DeprecationWarning (GH-117668)
* Fix `test_strptime` raises a DeprecationWarning
* Ignore deprecation warnings where appropriate.
* Update Lib/test/datetimetester.py
This is follow on work to silence unnecessary warnings from the test suite that changes for https://github.com/python/cpython/issues/70647 added.
(cherry picked from commit abead548af
)
Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
This commit is contained in:
parent
93ef7aa03c
commit
d3094744d4
2 changed files with 20 additions and 14 deletions
|
@ -22,6 +22,7 @@ from operator import lt, le, gt, ge, eq, ne, truediv, floordiv, mod
|
|||
|
||||
from test import support
|
||||
from test.support import is_resource_enabled, ALWAYS_EQ, LARGEST, SMALLEST
|
||||
from test.support import warnings_helper
|
||||
|
||||
import datetime as datetime_module
|
||||
from datetime import MINYEAR, MAXYEAR
|
||||
|
@ -2797,6 +2798,7 @@ class TestDateTime(TestDate):
|
|||
newdate = strptime(string, format)
|
||||
self.assertEqual(newdate, target, msg=reason)
|
||||
|
||||
@warnings_helper.ignore_warnings(category=DeprecationWarning)
|
||||
def test_strptime_leap_year(self):
|
||||
# GH-70647: warns if parsing a format with a day and no year.
|
||||
with self.assertRaises(ValueError):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue