mirror of
https://github.com/python/cpython.git
synced 2025-08-02 16:13:13 +00:00
move a FileIO test to test_fileio
This commit is contained in:
parent
accb38c74f
commit
81e92e582e
2 changed files with 9 additions and 8 deletions
|
@ -7,7 +7,7 @@ import unittest
|
|||
from array import array
|
||||
from weakref import proxy
|
||||
|
||||
from test.test_support import TESTFN, findfile, run_unittest
|
||||
from test.test_support import TESTFN, findfile, check_warnings, run_unittest
|
||||
from UserList import UserList
|
||||
|
||||
import _fileio
|
||||
|
@ -241,6 +241,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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue