MCPcopy Index your code
hub / github.com/python/cpython / test_name_resolution

Method test_name_resolution

Lib/test/test_pkgutil.py:234–323  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

232 list(pkgutil.walk_packages(bytes_input))
233
234 def test_name_resolution(self):
235 import logging
236 import logging.handlers
237
238 success_cases = (
239 ('os', os),
240 ('os.path', os.path),
241 ('os.path:pathsep', os.path.pathsep),
242 ('logging', logging),
243 ('logging:', logging),
244 ('logging.handlers', logging.handlers),
245 ('logging.handlers:', logging.handlers),
246 ('logging.handlers:SysLogHandler', logging.handlers.SysLogHandler),
247 ('logging.handlers.SysLogHandler', logging.handlers.SysLogHandler),
248 ('logging.handlers:SysLogHandler.LOG_ALERT',
249 logging.handlers.SysLogHandler.LOG_ALERT),
250 ('logging.handlers.SysLogHandler.LOG_ALERT',
251 logging.handlers.SysLogHandler.LOG_ALERT),
252 ('builtins.int', int),
253 ('builtins:int', int),
254 ('builtins.int.from_bytes', int.from_bytes),
255 ('builtins:int.from_bytes', int.from_bytes),
256 ('builtins.ZeroDivisionError', ZeroDivisionError),
257 ('builtins:ZeroDivisionError', ZeroDivisionError),
258 ('os:path', os.path),
259 )
260
261 failure_cases = (
262 (None, TypeError),
263 (1, TypeError),
264 (2.0, TypeError),
265 (True, TypeError),
266 ('', ValueError),
267 ('?abc', ValueError),
268 ('abc/foo', ValueError),
269 ('foo', ImportError),
270 ('os.foo', AttributeError),
271 ('os.foo:', ImportError),
272 ('os.pth:pathsep', ImportError),
273 ('logging.handlers:NoSuchHandler', AttributeError),
274 ('logging.handlers:SysLogHandler.NO_SUCH_VALUE', AttributeError),
275 ('logging.handlers.SysLogHandler.NO_SUCH_VALUE', AttributeError),
276 ('ZeroDivisionError', ImportError),
277 ('os.path.9abc', ValueError),
278 ('9abc', ValueError),
279 )
280
281 # add some Unicode package names to the mix.
282
283 unicode_words = ('\u0935\u092e\u0938',
284 '\xe9', '\xc8',
285 '\uc548\ub155\ud558\uc138\uc694',
286 '\u3055\u3088\u306a\u3089',
287 '\u3042\u308a\u304c\u3068\u3046',
288 '\u0425\u043e\u0440\u043e\u0448\u043e',
289 '\u0441\u043f\u0430\u0441\u0438\u0431\u043e',
290 '\u73b0\u4ee3\u6c49\u8bed\u5e38\u7528\u5b57\u8868')
291

Callers

nothing calls this directly

Calls 9

openFunction · 0.50
joinMethod · 0.45
writeMethod · 0.45
flushMethod · 0.45
invalidate_cachesMethod · 0.45
import_moduleMethod · 0.45
subTestMethod · 0.45
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected