def test_compare_calls_InterTree_compare(self): """This test tests the way Tree.compare() uses InterTree.""" old_optimisers = InterTree._optimisers try: InterTree._optimisers = [] RecordingOptimiser.calls = [] InterTree.register_optimiser(RecordingOptimiser) tree = self.make_branch_and_tree('1') tree2 = self.make_branch_and_tree('2') # do a series of calls: # trivial usage tree.changes_from(tree2) # pass in all optional arguments by position tree.changes_from(tree2, 'unchanged', 'specific', 'extra', 'require', True) # pass in all optional arguments by keyword tree.changes_from(tree2, specific_files='specific', want_unchanged='unchanged', extra_trees='extra', require_versioned='require', include_root=True, want_unversioned=True, ) finally: InterTree._optimisers = old_optimisers self.assertEqual( [ ('compare', tree2, tree, False, None, None, False, False, False), ('compare', tree2, tree, 'unchanged', 'specific', 'extra', 'require', True, False), ('compare', tree2, tree, 'unchanged', 'specific', 'extra', 'require', True, True), ], RecordingOptimiser.calls)