(self, mod, ignores)
| 40 | |
| 41 | class TestDefaultExports(unittest.TestCase): |
| 42 | def check_module(self, mod, ignores): |
| 43 | names = dir(mod) |
| 44 | names.remove("__all__") |
| 45 | for name in mod.__all__: |
| 46 | if name not in names and name not in ignores: |
| 47 | self.fail(f"{name} was included in {mod}.__all__ but is not a valid symbol") |
| 48 | |
| 49 | for name in names: |
| 50 | if name not in mod.__all__ and name not in ignores: |
| 51 | if name in GLOBAL_INGORE: |
| 52 | continue |
| 53 | value = getattr(mod, name) |
| 54 | if inspect.ismodule(value): |
| 55 | continue |
| 56 | if getattr(value, "__module__", None) == "typing": |
| 57 | continue |
| 58 | if not name.startswith("_"): |
| 59 | self.fail(f"{name} was not included in {mod}.__all__") |
| 60 | |
| 61 | def test_pymongo(self): |
| 62 | self.check_module(pymongo, PYMONGO_IGNORE) |
no test coverage detected