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

Function test_collections_defaultdict

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

Source from the content-addressed store, hash-verified

275
276
277def test_collections_defaultdict():
278 # Create defaultdicts with cycles
279 a = defaultdict()
280 a.default_factory = a
281 b = defaultdict(list)
282 b['key'] = b
283
284 # Dictionary order cannot be relied on, test against single keys.
285 cases = [
286 (defaultdict(list), 'defaultdict(list, {})'),
287 (defaultdict(list, {'key': '-' * 50}),
288 "defaultdict(list,\n"
289 " {'key': '--------------------------------------------------'})"),
290 (a, 'defaultdict(defaultdict(...), {})'),
291 (b, "defaultdict(list, {'key': defaultdict(...)})"),
292 ]
293 for obj, expected in cases:
294 nt.assert_equal(pretty.pretty(obj), expected)
295
296
297def test_collections_ordereddict():

Callers

nothing calls this directly

Calls 1

prettyMethod · 0.80

Tested by

no test coverage detected