From 16865e0fe7123de7db84122246a5a005043a8774 2020-01-27 15:22:49 From: Eric Wieser Date: 2020-01-27 15:22:49 Subject: [PATCH] Simplify and extend the test for multiline repr `BreakingReprParent` is not really necessary here, testing using lists is easier to understand, and lets us test multiple lengths of list. --- diff --git a/IPython/lib/tests/test_pretty.py b/IPython/lib/tests/test_pretty.py index cd9fb36..695012d 100644 --- a/IPython/lib/tests/test_pretty.py +++ b/IPython/lib/tests/test_pretty.py @@ -68,11 +68,6 @@ class BreakingRepr(object): def __repr__(self): return "Breaking(\n)" -class BreakingReprParent(object): - def _repr_pretty_(self, p, cycle): - with p.group(4,"TG: ",":"): - p.pretty(BreakingRepr()) - class BadRepr(object): def __repr__(self): @@ -151,8 +146,12 @@ def test_pprint_break_repr(): """ Test that p.break_ is used in repr """ - output = pretty.pretty(BreakingReprParent()) - expected = "TG: Breaking(\n ):" + output = pretty.pretty([[BreakingRepr()]]) + expected = "[[Breaking(\n )]]" + nt.assert_equal(output, expected) + + output = pretty.pretty([[BreakingRepr()]*2]) + expected = "[[Breaking(\n ),\n Breaking(\n )]]" nt.assert_equal(output, expected) def test_bad_repr():