[diffoscope] 01/01: tests/comparators/test_containers: fix, we want product not permutations

Ximin Luo infinity0 at debian.org
Mon Oct 9 20:18:00 CEST 2017


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch master
in repository diffoscope.

commit 71fb842d7bbae27f865324ee97fe92b3e9452b68
Author: Ximin Luo <infinity0 at debian.org>
Date:   Mon Oct 9 20:17:36 2017 +0200

    tests/comparators/test_containers: fix, we want product not permutations
---
 tests/comparators/test_containers.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/tests/comparators/test_containers.py b/tests/comparators/test_containers.py
index 5660681..ac6d55d 100644
--- a/tests/comparators/test_containers.py
+++ b/tests/comparators/test_containers.py
@@ -52,21 +52,22 @@ def expected_type_diff(ext1, ext2):
 
 # Compares same content files, but with different extensions
 def test_equal(set1):
-    for x, y in itertools.permutations(TYPES, 2):
-        differences = set1[x].compare(set1[y]).details
+    for x, y in itertools.product(TYPES, TYPES):
+        diff = set1[x].compare(set1[y])
         if x == y:
-            assert differences is None
+            assert diff is None
         else:
+            differences = diff.details
             assert differences[0].unified_diff == expected_magic_diff(x, y)
             assert differences[1].unified_diff == expected_type_diff(x, y)
 
 # Compares different content files with different extensions
 def test_different(set1, set2):
-    for x, y in itertools.permutations(TYPES, 2):
+    for x, y in itertools.product(TYPES, TYPES):
         expected_diff = get_data('containers/different_files_expected_diff')
         differences = set1[x].compare(set2[y]).details
         if x == y:
-            assert differences is None
+            assert differences[0].details[1].unified_diff == expected_diff
         else:
             assert differences[0].unified_diff == expected_magic_diff(x, y)
             assert differences[1].unified_diff == expected_type_diff(x, y)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git


More information about the diffoscope mailing list