]> granicus.if.org Git - python/commitdiff
Fix various missing import/unbound name errors.
authorGeorg Brandl <georg@python.org>
Sat, 6 Feb 2010 23:18:00 +0000 (23:18 +0000)
committerGeorg Brandl <georg@python.org>
Sat, 6 Feb 2010 23:18:00 +0000 (23:18 +0000)
Lib/test/test_richcmp.py
Lib/test/test_tempfile.py
Lib/test/test_threaded_import.py
Lib/test/test_zipimport.py

index ed0b497a78297a7b734fad0f65b24397aad659e8..cc174d85bef718b77e9c1cc2ee2ee4138705f55e 100644 (file)
@@ -192,13 +192,13 @@ class MiscTest(unittest.TestCase):
 
     def test_misbehavin(self):
         class Misb:
-            def __lt__(self, other): return 0
-            def __gt__(self, other): return 0
-            def __eq__(self, other): return 0
-            def __le__(self, other): raise TestFailed, "This shouldn't happen"
-            def __ge__(self, other): raise TestFailed, "This shouldn't happen"
-            def __ne__(self, other): raise TestFailed, "This shouldn't happen"
-            def __cmp__(self, other): raise RuntimeError, "expected"
+            def __lt__(self_, other): return 0
+            def __gt__(self_, other): return 0
+            def __eq__(self_, other): return 0
+            def __le__(self_, other): self.fail("This shouldn't happen")
+            def __ge__(self_, other): self.fail("This shouldn't happen")
+            def __ne__(self_, other): self.fail("This shouldn't happen")
+            def __cmp__(self_, other): raise RuntimeError, "expected"
         a = Misb()
         b = Misb()
         self.assertEqual(a<b, 0)
index a35821000d04dc4ac9159c2e82ed3ee19e98e7f9..2b73f5441e768e1637a31ea29e214b3737c7927f 100644 (file)
@@ -127,7 +127,7 @@ class test__RandomNameSequence(TC):
                 if i == 20:
                     break
         except:
-            failOnException("iteration")
+            self.failOnException("iteration")
 
 test_classes.append(test__RandomNameSequence)
 
index fdbd7b79e76536e12c2335e673079c79d45ed42c..4b925c42b5989fbff73f03f7940938a0aa8f8107 100644 (file)
@@ -6,6 +6,7 @@
 # randrange, and then Python hangs.
 
 import thread
+import unittest
 from test.test_support import verbose, TestFailed
 
 critical_section = thread.allocate_lock()
index fa11d20e49d5fa32806986050e0401e59642ff5c..60a14523f0b70ea3aeb637501e51e2991ca1b0bd 100644 (file)
@@ -230,7 +230,7 @@ class UncompressedZipImportTestCase(ImportHooksBaseTestCase):
 
             mod_path = packdir2 + TESTMOD
             mod_name = module_path_to_dotted_name(mod_path)
-            pkg = __import__(mod_name)
+            __import__(mod_name)
             mod = sys.modules[mod_name]
             self.assertEquals(zi.get_source(TESTPACK), None)
             self.assertEquals(zi.get_source(mod_path), None)
@@ -274,7 +274,7 @@ class UncompressedZipImportTestCase(ImportHooksBaseTestCase):
 
             mod_path = TESTPACK2 + os.sep + TESTMOD
             mod_name = module_path_to_dotted_name(mod_path)
-            pkg = __import__(mod_name)
+            __import__(mod_name)
             mod = sys.modules[mod_name]
             self.assertEquals(zi.get_source(TESTPACK2), None)
             self.assertEquals(zi.get_source(mod_path), None)