summaryrefslogtreecommitdiff
path: root/Lib/test
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_fileio.py10
-rw-r--r--Lib/test/test_io.py1
2 files changed, 10 insertions, 1 deletions
diff --git a/Lib/test/test_fileio.py b/Lib/test/test_fileio.py
index 0404a1979f..a11d3ba117 100644
--- a/Lib/test/test_fileio.py
+++ b/Lib/test/test_fileio.py
@@ -6,7 +6,7 @@ import unittest
from array import array
from weakref import proxy
-from test.support import TESTFN, findfile, run_unittest
+from test.support import TESTFN, findfile, check_warnings, run_unittest
from collections import UserList
import _fileio
@@ -240,6 +240,14 @@ class OtherFileTests(unittest.TestCase):
def testInvalidInit(self):
self.assertRaises(TypeError, _fileio._FileIO, "1", 0, 0)
+ def testWarnings(self):
+ with check_warnings() as w:
+ self.assertEqual(w.warnings, [])
+ self.assertRaises(TypeError, _fileio._FileIO, [])
+ self.assertEqual(w.warnings, [])
+ self.assertRaises(ValueError, _fileio._FileIO, "/some/invalid/name", "rt")
+ self.assertEqual(w.warnings, [])
+
def test_main():
# Historically, these tests have been sloppy about removing TESTFN.
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
index 1f0295c1d4..83d363dbd0 100644
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -1260,6 +1260,7 @@ class MiscIOTest(unittest.TestCase):
else:
self.assert_(issubclass(obj, io.IOBase))
+
def test_main():
support.run_unittest(IOTest, BytesIOTest, StringIOTest,
BufferedReaderTest, BufferedWriterTest,