[Python-3000-checkins] r61835 - python/branches/py3k/Lib/test/test_fileinput.py

neal.norwitz python-3000-checkins at python.org
Mon Mar 24 07:10:14 CET 2008


Author: neal.norwitz
Date: Mon Mar 24 07:10:13 2008
New Revision: 61835

Modified:
   python/branches/py3k/Lib/test/test_fileinput.py
Log:
Ensure cleanup does not reference variables that don't yet exist.

Modified: python/branches/py3k/Lib/test/test_fileinput.py
==============================================================================
--- python/branches/py3k/Lib/test/test_fileinput.py	(original)
+++ python/branches/py3k/Lib/test/test_fileinput.py	Mon Mar 24 07:10:13 2008
@@ -34,6 +34,7 @@
     def test_buffer_sizes(self):
         # First, run the tests with default and teeny buffer size.
         for round, bs in (0, 0), (1, 30):
+            t1 = t2 = t3 = t4 = None
             try:
                 t1 = writeTmp(1, ["Line %s of file 1\n" % (i+1) for i in range(15)])
                 t2 = writeTmp(2, ["Line %s of file 2\n" % (i+1) for i in range(10)])
@@ -122,6 +123,7 @@
 
 class FileInputTests(unittest.TestCase):
     def test_zero_byte_files(self):
+        t1 = t2 = t3 = t4 = None
         try:
             t1 = writeTmp(1, [""])
             t2 = writeTmp(2, [""])
@@ -145,6 +147,7 @@
             remove_tempfiles(t1, t2, t3, t4)
 
     def test_files_that_dont_end_with_newline(self):
+        t1 = t2 = None
         try:
             t1 = writeTmp(1, ["A\nB\nC"])
             t2 = writeTmp(2, ["D\nE\nF"])
@@ -171,6 +174,7 @@
 ##             remove_tempfiles(t1)
 
     def test_fileno(self):
+        t1 = t2 = None
         try:
             t1 = writeTmp(1, ["A\nB"])
             t2 = writeTmp(2, ["C\nD"])


More information about the Python-3000-checkins mailing list