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 | 2480c2ed593a164fe3a4821a13d5867a0a7102ed (patch) | |
tree | e33efad894bf91e221465d7ce251531ea01d6319 /Lib/test/test_fileinput.py | |
parent | ed8c9061270b619de1d603ac34502b41cc84822f (diff) | |
download | cpython-git-2480c2ed593a164fe3a4821a13d5867a0a7102ed.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) |