def test_helper_parantheses(): class A(object): def __repr__(self): r = ReprHelper(self) r.parantheses = ('<', '>') r.keyword_with_value('id', hex(id(self)), raw=True) return str(r) def _repr_pretty_(self, p, cycle): r = PrettyReprHelper(self, p, cycle) r.parantheses = ('<', '>') with r: r.keyword_with_value('id', hex(id(self)), raw=True) a = A() assert repr(a) == 'A<id={}>'.format(hex(id(a))) assert pretty(a) == 'A<id={}>'.format(hex(id(a))) # Test namedtuple for parantheses property r = ReprHelper(a) assert repr(r.parantheses) == "Parantheses(left='(', right=')')" r.parantheses = ('<', '>') assert repr(r.parantheses) == "Parantheses(left='<', right='>')"
def __repr__(self): r = ReprHelper(self) r.parantheses = ('<', '>') r.positional_from_attr('_engine') return str(r)
def __repr__(self): r = ReprHelper(self) r.parantheses = ('<', '>') r.keyword_from_attr('controller') return str(r)
def __repr__(self): r = ReprHelper(self) r.parantheses = ('<', '>') r.keyword_from_attr('identity') return str(r)
def __repr__(self): r = ReprHelper(self) r.parantheses = ('<', '>') r.keyword_with_value('id', hex(id(self)), raw=True) return str(r)