def test_tree_minimizes_number_of_branch_children(): assert smallest_tree(lambda t: isinstance(t, Branch)) == Branch(0, ())
def test_tree_minimizes_individual_branch_children(): assert smallest_tree( lambda t: len(getattr(t, u'keyed_children', ())) > 1) == Branch( 0, ((0, Leaf(0)), (0, Leaf(0))))
def test_simplify_tree_label(): xs = smallest_tree(lambda t: isinstance(t, Branch) and t.label >= 10) assert xs == Branch(10, ())