The invert_tree_challenge Jupyter notebook has a nose unit-test that looks like this:
assert_equal(result, root)
Where result and root are Node objects. I wrote a solution to this challenge that involved creating a new Node object versus re-using the existing one, but this failed because there was no __eq__ method defined in the Node class to enable comparison with other Nodes.
The
invert_tree_challenge
Jupyter notebook has a nose unit-test that looks like this:Where
result
androot
areNode
objects. I wrote a solution to this challenge that involved creating a newNode
object versus re-using the existing one, but this failed because there was no__eq__
method defined in theNode
class to enable comparison with other Nodes.This minor pull request addresses three things:
__repr__
method to aid debugging.__eq__
method to compare nodes in a tree.Thanks!