ยปCore Development>Code coverage>Lib/importlib/test/extension/test_finder.py

Python code coverage for Lib/importlib/test/extension/test_finder.py

#countcontent
1n/afrom importlib import _bootstrap
2n/afrom .. import abc
3n/afrom . import util
4n/a
5n/aimport imp
6n/aimport unittest
7n/a
8n/aclass FinderTests(abc.FinderTests):
9n/a
10n/a """Test the finder for extension modules."""
11n/a
12n/a def find_module(self, fullname):
13n/a importer = _bootstrap.FileFinder(util.PATH,
14n/a (_bootstrap.ExtensionFileLoader,
15n/a imp.extension_suffixes(),
16n/a False))
17n/a return importer.find_module(fullname)
18n/a
19n/a def test_module(self):
20n/a self.assertTrue(self.find_module(util.NAME))
21n/a
22n/a def test_package(self):
23n/a # Extension modules cannot be an __init__ for a package.
24n/a pass
25n/a
26n/a def test_module_in_package(self):
27n/a # No extension module in a package available for testing.
28n/a pass
29n/a
30n/a def test_package_in_package(self):
31n/a # Extension modules cannot be an __init__ for a package.
32n/a pass
33n/a
34n/a def test_package_over_module(self):
35n/a # Extension modules cannot be an __init__ for a package.
36n/a pass
37n/a
38n/a def test_failure(self):
39n/a self.assertIsNone(self.find_module('asdfjkl;'))
40n/a
41n/a # XXX Raise an exception if someone tries to use the 'path' argument?
42n/a
43n/a
44n/adef test_main():
45n/a from test.support import run_unittest
46n/a run_unittest(FinderTests)
47n/a
48n/a
49n/aif __name__ == '__main__':
50n/a test_main()