mirror of
https://github.com/python/cpython.git
synced 2025-11-02 11:08:57 +00:00
Issue #26385: Merge NamedTemporaryFile fix from 3.5
This commit is contained in:
commit
93088d1b03
3 changed files with 14 additions and 2 deletions
|
|
@ -948,8 +948,16 @@ class TestNamedTemporaryFile(BaseTestCase):
|
|||
self.assertRaises(ValueError, tempfile.NamedTemporaryFile)
|
||||
self.assertEqual(len(closed), 1)
|
||||
|
||||
# How to test the mode and bufsize parameters?
|
||||
def test_bad_mode(self):
|
||||
dir = tempfile.mkdtemp()
|
||||
self.addCleanup(support.rmtree, dir)
|
||||
with self.assertRaises(ValueError):
|
||||
tempfile.NamedTemporaryFile(mode='wr', dir=dir)
|
||||
with self.assertRaises(TypeError):
|
||||
tempfile.NamedTemporaryFile(mode=2, dir=dir)
|
||||
self.assertEqual(os.listdir(dir), [])
|
||||
|
||||
# How to test the mode and bufsize parameters?
|
||||
|
||||
class TestSpooledTemporaryFile(BaseTestCase):
|
||||
"""Test SpooledTemporaryFile()."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue