def test_is_module_name_part_of_extension_package_whitelist_success( self) -> None: """Test that the is_module_name_part_of_extension_package_whitelist function returns False when needed""" self.assertFalse( modutils.is_module_name_part_of_extension_package_whitelist( "numpy", {"numpy.core"})) self.assertFalse( modutils.is_module_name_part_of_extension_package_whitelist( "numpy.core", {"numpy.core.umath"})) self.assertFalse( modutils.is_module_name_part_of_extension_package_whitelist( "core.umath", {"numpy"}))
def _can_load_extension(self, modname: str) -> bool: if self.always_load_extensions: return True if is_standard_module(modname): return True return is_module_name_part_of_extension_package_whitelist( modname, self.extension_package_whitelist)