def test_check_order(self): lines = self.make_tag_lines() headers = lines[:4] rest = lines[4:] # of all possible permutations, ensure only the original succeeds for perm in permutations(headers): perm = list(perm) text = '\n'.join(perm + rest) if perm == headers: self.assertCheckSucceeds(Tag, text) else: self.assertCheckFails(Tag, text)
def test_check_order(self): lines = self.make_commit_lines(parents=[a_sha], encoding='UTF-8') headers = lines[:5] rest = lines[5:] # of all possible permutations, ensure only the original succeeds for perm in permutations(headers): perm = list(perm) text = '\n'.join(perm + rest) if perm == headers: self.assertCheckSucceeds(Commit, text) else: self.assertCheckFails(Commit, text)
def test_tree_entry_sort(self): sha = 'abcd' * 10 expected_entries = [ TreeChange.add(TreeEntry('aaa', F, sha)), TreeChange(CHANGE_COPY, TreeEntry('bbb', F, sha), TreeEntry('aab', F, sha)), TreeChange(CHANGE_MODIFY, TreeEntry('bbb', F, sha), TreeEntry('bbb', F, 'dabc' * 10)), TreeChange(CHANGE_RENAME, TreeEntry('bbc', F, sha), TreeEntry('ddd', F, sha)), TreeChange.delete(TreeEntry('ccc', F, sha)), ] for perm in permutations(expected_entries): self.assertEqual(expected_entries, sorted(perm, key=_tree_change_key))
def test_topo_reorder_linear(self): commits = self.make_linear_commits(5) commits.reverse() for perm in permutations(commits): self.assertTopoOrderEqual(commits, perm)