MCPcopy Create free account
hub / github.com/ipython/ipython / test_mappingproxy

Function test_mappingproxy

IPython/lib/tests/test_pretty.py:365–407  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

363 nt.assert_equal(pretty.pretty(obj), expected)
364
365def test_mappingproxy():
366 MP = types.MappingProxyType
367 underlying_dict = {}
368 mp_recursive = MP(underlying_dict)
369 underlying_dict[2] = mp_recursive
370 underlying_dict[3] = underlying_dict
371
372 cases = [
373 (MP({}), "mappingproxy({})"),
374 (MP({None: MP({})}), "mappingproxy({None: mappingproxy({})})"),
375 (MP({k: k.upper() for k in string.ascii_lowercase}),
376 "mappingproxy({'a': 'A',\n"
377 " 'b': 'B',\n"
378 " 'c': 'C',\n"
379 " 'd': 'D',\n"
380 " 'e': 'E',\n"
381 " 'f': 'F',\n"
382 " 'g': 'G',\n"
383 " 'h': 'H',\n"
384 " 'i': 'I',\n"
385 " 'j': 'J',\n"
386 " 'k': 'K',\n"
387 " 'l': 'L',\n"
388 " 'm': 'M',\n"
389 " 'n': 'N',\n"
390 " 'o': 'O',\n"
391 " 'p': 'P',\n"
392 " 'q': 'Q',\n"
393 " 'r': 'R',\n"
394 " 's': 'S',\n"
395 " 't': 'T',\n"
396 " 'u': 'U',\n"
397 " 'v': 'V',\n"
398 " 'w': 'W',\n"
399 " 'x': 'X',\n"
400 " 'y': 'Y',\n"
401 " 'z': 'Z'})"),
402 (mp_recursive, "mappingproxy({2: {...}, 3: {2: {...}, 3: {...}}})"),
403 (underlying_dict,
404 "{2: mappingproxy({2: {...}, 3: {...}}), 3: {...}}"),
405 ]
406 for obj, expected in cases:
407 nt.assert_equal(pretty.pretty(obj), expected)
408
409
410def test_simplenamespace():

Callers

nothing calls this directly

Calls 1

prettyMethod · 0.80

Tested by

no test coverage detected