[Python-checkins] r56997 - sandbox/trunk/import_in_py/tests/test_fs_importer.py

brett.cannon python-checkins at python.org
Tue Aug 14 02:50:24 CEST 2007


Author: brett.cannon
Date: Tue Aug 14 02:50:23 2007
New Revision: 56997

Modified:
   sandbox/trunk/import_in_py/tests/test_fs_importer.py
Log:
Add a test for PyFileImporter file type order.


Modified: sandbox/trunk/import_in_py/tests/test_fs_importer.py
==============================================================================
--- sandbox/trunk/import_in_py/tests/test_fs_importer.py	(original)
+++ sandbox/trunk/import_in_py/tests/test_fs_importer.py	Tue Aug 14 02:50:23 2007
@@ -77,7 +77,16 @@
 
     def test_file_type_order(self):
         # The order of the search should be preserved.
-        raise NotImplementedError
+        assert os.path.exists(self.py_path)
+        assert self.py_ext in self.importer._suffixes
+        assert os.path.exists(self.pyc_path)
+        assert self.pyc_ext in self.importer._suffixes
+        assert self.importer._suffixes[0] in [self.py_ext, self.pyc_ext]
+        expected = self.importer._suffixes[0]
+        found = self.importer.find_module(self.module_name)
+        ext = os.path.splitext(found)[1]
+        self.assertEqual(ext, self.importer._suffixes[0])
+
 
     def test_missing__init__warning(self):
         # An ImportWarning should be raised if a directory matches a module


More information about the Python-checkins mailing list