mirror of
https://github.com/django/django.git
synced 2025-10-26 07:06:08 +00:00
Fixed #22531 -- Added tree.Node.__repr__ and tests for the class.
While Node class has a useful `__str__`, its `__repr__` is not that useful. Added a `__repr__` that makes use of the current `__str__`. This is especially useful since the more popular `Q` class inherits `tree.Node`. Also created new tests that cover most of `Node` class functionality.
This commit is contained in:
committed by
Tim Graham
parent
fadc6cd1bd
commit
393ddc10a7
@@ -48,6 +48,9 @@ class Node(object):
|
||||
return '(%s: %s)' % (self.connector, ', '.join([str(c) for c in
|
||||
self.children]))
|
||||
|
||||
def __repr__(self):
|
||||
return "<%s: %s>" % (self.__class__.__name__, self)
|
||||
|
||||
def __deepcopy__(self, memodict):
|
||||
"""
|
||||
Utility method used by copy.deepcopy().
|
||||
|
||||
Reference in New Issue
Block a user