diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-10-31 16:04:14 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-10-31 16:04:14 (GMT) |
commit | f569826f06a035b749164f9530efc25fec10691d (patch) | |
tree | 35e32ceb500515c64c7c3181e65e7001bbe01c52 /Lib/test/test_uu.py | |
parent | e974571d36009e327a97bb83389cf05c2b858288 (diff) | |
download | cpython-f569826f06a035b749164f9530efc25fec10691d.zip cpython-f569826f06a035b749164f9530efc25fec10691d.tar.gz cpython-f569826f06a035b749164f9530efc25fec10691d.tar.bz2 |
Issue #10266: uu.decode didn't close in_file explicitly when it was given
as a filename. Patch by Brian Brazil.
Diffstat (limited to 'Lib/test/test_uu.py')
-rw-r--r-- | Lib/test/test_uu.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_uu.py b/Lib/test/test_uu.py index a54f2c1..d6875c5 100644 --- a/Lib/test/test_uu.py +++ b/Lib/test/test_uu.py @@ -196,6 +196,23 @@ class UUFileTest(unittest.TestCase): finally: self._kill(f) + def test_decode_filename(self): + f = None + try: + support.unlink(self.tmpin) + f = open(self.tmpin, 'wb') + f.write(encodedtextwrapped(0o644, self.tmpout)) + f.close() + + uu.decode(self.tmpin) + + f = open(self.tmpout, 'rb') + s = f.read() + f.close() + self.assertEqual(s, plaintext) + finally: + self._kill(f) + def test_decodetwice(self): # Verify that decode() will refuse to overwrite an existing file f = None |