def test_knotted(self): a = list(range(100)) b = list(range(200)) a[-12] = b # Verify .isrecursive() and .isreadable() w/ recursion # Tie a knot. b[67] = a # Messy dict. d = {} d[0] = d[1] = d[2] = d pp = FancyPrinter() for icky in a, b, d, (d, d): assert pp.isrecursive(icky), "expected isrecursive" assert not pp.isreadable(icky), "expected not isreadable" # Break the cycles. d.clear() del a[:] del b[:] for safe in a, b, d, (d, d): # module-level convenience functions # PrettyPrinter methods assert not pp.isrecursive(safe), f"expected not isrecursive for {safe!r}" assert pp.isreadable(safe), f"expected isreadable for {safe!r}"
def test_basic(self, safe): # Verify .isrecursive() and .isreadable() w/o recursion pp = FancyPrinter() # PrettyPrinter methods assert not pp.isrecursive(safe), f"expected not isrecursive for {safe!r}" assert pp.isreadable(safe), f"expected isreadable for {safe!r}"