diff options
author | Ethan Furman <ethan@stoneleaf.us> | 2014-01-12 16:42:35 (GMT) |
---|---|---|
committer | Ethan Furman <ethan@stoneleaf.us> | 2014-01-12 16:42:35 (GMT) |
commit | a70805e1fa592076cc1188a62fbf35b6b863c430 (patch) | |
tree | d64863f91486205838cbce3eb1516317c6d6e552 /Lib/test/test_unicode.py | |
parent | 61dab6e3fa2f40454f29dcee9477bc52a049965e (diff) | |
download | cpython-a70805e1fa592076cc1188a62fbf35b6b863c430.zip cpython-a70805e1fa592076cc1188a62fbf35b6b863c430.tar.gz cpython-a70805e1fa592076cc1188a62fbf35b6b863c430.tar.bz2 |
Issue19995: fixed typo; switched from test.support.check_warnings to assertWarns
Diffstat (limited to 'Lib/test/test_unicode.py')
-rw-r--r-- | Lib/test/test_unicode.py | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py index d31838c..8175fee 100644 --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -1139,13 +1139,6 @@ class UnicodeTest(string_tests.CommonTest, self.value = float(value) def __int__(self): return int(self.value) - def check_depr(modifier, value): - with support.check_warnings( - ("", DeprecationWarning), - quiet=False, - ): - warnings.simplefilter('always') - modifier % value pi = PsuedoFloat(3.1415) letter_m = PsuedoInt(109) self.assertEqual('%x' % 42, '2a') @@ -1156,14 +1149,11 @@ class UnicodeTest(string_tests.CommonTest, self.assertEqual('%X' % letter_m, '6D') self.assertEqual('%o' % letter_m, '155') self.assertEqual('%c' % letter_m, 'm') - for mod, value in ( - ('%x', pi), - ('%x', 3.14), - ('%X', 2.11), - ('%o', 1.79), - ('%c', pi), - ): - check_depr(mod, value) + self.assertWarns(DeprecationWarning, '%x'.__mod__, pi), + self.assertWarns(DeprecationWarning, '%x'.__mod__, 3.14), + self.assertWarns(DeprecationWarning, '%X'.__mod__, 2.11), + self.assertWarns(DeprecationWarning, '%o'.__mod__, 1.79), + self.assertWarns(DeprecationWarning, '%c'.__mod__, pi), def test_formatting_with_enum(self): # issue18780 |