[diffoscope] 03/05: tests: Move normalize_zeros to more generic `utils.data` module.

Mattia Rizzolo mattia at debian.org
Mon Feb 20 19:53:13 CET 2017


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

mattia pushed a commit to annotated tag 77_bpo8+1
in repository diffoscope.

commit d51db5286b674f636727437ca8ddda7803149204
Author: Chris Lamb <lamby at debian.org>
Date:   Sat Feb 18 14:43:29 2017 +1300

    tests: Move normalize_zeros to more generic `utils.data` module.
---
 tests/comparators/test_binary.py | 6 +-----
 tests/comparators/utils/data.py  | 5 +++++
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/tests/comparators/test_binary.py b/tests/comparators/test_binary.py
index aee0e19..3a0e90d 100644
--- a/tests/comparators/test_binary.py
+++ b/tests/comparators/test_binary.py
@@ -32,7 +32,7 @@ from diffoscope.comparators.utils.file import File
 from diffoscope.comparators.missing_file import MissingFile
 from diffoscope.comparators.utils.compare import Xxd
 
-from utils.data import data, init_fixture, get_data
+from utils.data import data, init_fixture, get_data, normalize_zeros
 from utils.tools import skip_unless_tools_exist
 
 
@@ -46,10 +46,6 @@ TEST_ISO8859_PATH = data('text_iso8859')
 binary1 = init_fixture(TEST_FILE1_PATH)
 binary2 = init_fixture(TEST_FILE2_PATH)
 
-def normalize_zeros(s):
-    # older xxd had one zero less.  Make sure there are always 8.
-    return s.replace('-0000000:', '-00000000:').replace('+0000000:', '+00000000:')
-
 def test_same_content(binary1):
     assert binary1.has_same_content_as(binary1) is True
 
diff --git a/tests/comparators/utils/data.py b/tests/comparators/utils/data.py
index c1d2c2c..23464c7 100644
--- a/tests/comparators/utils/data.py
+++ b/tests/comparators/utils/data.py
@@ -47,3 +47,8 @@ def get_data(filename):
 
 def load_fixture(filename):
     return init_fixture(data(filename))
+
+
+def normalize_zeros(s):
+    # older xxd had one zero less.  Make sure there are always 8.
+    return s.replace('-0000000:', '-00000000:').replace('+0000000:', '+00000000:')

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


More information about the diffoscope mailing list