added tests and shaved off a couple more lines

In particular, I removed all the methods from the `TreeNode` class because they could be replaced standard attribute access (getters and setters are considered rather un-pythonic).