mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue 9856: Change object.__format__ with a non-empty format string from a PendingDeprecationWarning to a DeprecationWarning.
This commit is contained in:
parent
e4f6a80ed8
commit
b9cd3531c4
4 changed files with 21 additions and 17 deletions
|
@ -1279,14 +1279,14 @@ class BuiltinTest(unittest.TestCase):
|
|||
|
||||
# --------------------------------------------------------------------
|
||||
# Issue #7994: object.__format__ with a non-empty format string is
|
||||
# pending deprecated
|
||||
# deprecated
|
||||
def test_deprecated_format_string(obj, fmt_str, should_raise_warning):
|
||||
with warnings.catch_warnings(record=True) as w:
|
||||
warnings.simplefilter("always", PendingDeprecationWarning)
|
||||
warnings.simplefilter("always", DeprecationWarning)
|
||||
format(obj, fmt_str)
|
||||
if should_raise_warning:
|
||||
self.assertEqual(len(w), 1)
|
||||
self.assertIsInstance(w[0].message, PendingDeprecationWarning)
|
||||
self.assertIsInstance(w[0].message, DeprecationWarning)
|
||||
self.assertIn('object.__format__ with a non-empty format '
|
||||
'string', str(w[0].message))
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue