Add a test for the ancestors flag to tree_info
Add a test for print_debug_info
Deuglify the print_debug_info unittest by adding a `file` argument

The argument name is inspired by Python3's print function.