def test_new_top_smallest_replaces_old_max(self) -> None: ranker = diff.UnifiedDiffRanker(2) ranker("file1", ["line1\n", "line2\n"], ["1\n", "2\n"]) ranker("file2", [], ["1\n", "2\n", "3\n", "4\n", "5\n"]) ranker("file3", ["a\n", "b\n"], ["a\n", "c\n"]) act = [diffsize_filename for diffsize_filename, _, _ in ranker] exp = [(2, "file3"), (4, "file1")] self.assertListEqual(exp, act)
def __init__(self, opts: argparse.Namespace): self._opts = opts self.call_count = 0 self.ranker = diff.UnifiedDiffRanker(opts.diff_smallest)