diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-11-24 23:13:26 +0200 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-11-24 23:13:26 +0200 |
commit | 6421a893e42c136a02b64369c8ffe72dbf857548 (patch) | |
tree | 70b48d165d388754860f2fc9308c573ff67af190 /Lib/test/test_fileinput.py | |
parent | 7e6e0d2ac32dbfb710212d42fe3831995b442f4d (diff) | |
download | cpython-6421a893e42c136a02b64369c8ffe72dbf857548.tar.gz |
Issue #15204: Silence and check the 'U' mode deprecation warnings in tests.
Changed deprecation message in the fileinput module.
Diffstat (limited to 'Lib/test/test_fileinput.py')
-rw-r--r-- | Lib/test/test_fileinput.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/test/test_fileinput.py b/Lib/test/test_fileinput.py index c5e57d4715..db6082cb12 100644 --- a/Lib/test/test_fileinput.py +++ b/Lib/test/test_fileinput.py @@ -22,7 +22,7 @@ except ImportError: from io import StringIO from fileinput import FileInput, hook_encoded -from test.support import verbose, TESTFN, run_unittest +from test.support import verbose, TESTFN, run_unittest, check_warnings from test.support import unlink as safe_unlink @@ -224,8 +224,10 @@ class FileInputTests(unittest.TestCase): try: # try opening in universal newline mode t1 = writeTmp(1, [b"A\nB\r\nC\rD"], mode="wb") - fi = FileInput(files=t1, mode="U") - lines = list(fi) + with check_warnings(('', DeprecationWarning)): + fi = FileInput(files=t1, mode="U") + with check_warnings(('', DeprecationWarning)): + lines = list(fi) self.assertEqual(lines, ["A\n", "B\n", "C\n", "D"]) finally: remove_tempfiles(t1) |