[Python-checkins] r57429 - sandbox/trunk/import_in_py/zipimport_/tests.py

brett.cannon python-checkins at python.org
Sat Aug 25 01:31:51 CEST 2007


Author: brett.cannon
Date: Sat Aug 25 01:31:51 2007
New Revision: 57429

Modified:
   sandbox/trunk/import_in_py/zipimport_/tests.py
Log:
Flesh out the test for is_package and add stubs for what still needs to be
checked.


Modified: sandbox/trunk/import_in_py/zipimport_/tests.py
==============================================================================
--- sandbox/trunk/import_in_py/zipimport_/tests.py	(original)
+++ sandbox/trunk/import_in_py/zipimport_/tests.py	Sat Aug 25 01:31:51 2007
@@ -82,7 +82,7 @@
     def test_top_level(self):
         # Should be able to find a top-level module if there is source,
         # bytecode, or both.
-        for importer, result in self.look_for('_pkg'):
+        for importer, result in self.look_for('_top_level'):
             self.assert_(importer is result)
         for importer, result in self.look_for('_bogus'):
             self.assert_(result is None)
@@ -116,21 +116,40 @@
 
 class IsPackage(unittest.TestCase):
 
-    """test zipimporter.is_package()."""
+    """Test zipimporter.is_package()."""
 
     def test_pkg(self):
         # A package should always return True.
         for args in [[True, True], [True, False], [False, True]]:
             with temp_zipfile(*args) as zip_path:
                 importer = zipimport.zipimporter(zip_path)
+                importer.find_module('_pkg')
                 self.assert_(importer.is_package('_pkg'))
+                importer.find_module('_top_level')
                 self.assert_(not importer.is_package('_top_level'))
+                importer.find_module('_pkg.submodule')
                 self.assert_(not importer.is_package('_pkg.submodule'))
+
+
+class GetSource(unittest.TestCase):
+
+    """Test zipimporter.get_source()."""
+
+    def test_get_source(self):
+        raise NotImplementedError
+
+
+class LoadModule(unittest.TestCase):
+
+    """Test zipimporter.load_module()."""
+
+    def test_basic(self):
+        raise NotImplementedError
  
 
 def test_main():
     test_support.run_unittest(ZipImportErrorTests, ZipImportCreation,
-            FindModule, GetData, IsPackage)
+            FindModule, GetData, IsPackage, GetSource, LoadModule)
 
 
 if __name__ == '__main__':


More information about the Python-checkins mailing list