[Git][reproducible-builds/diffoscope][master] 2 commits: Move to using assert_diff in ICO and JPEG tests.
Chris Lamb (@lamby)
gitlab at salsa.debian.org
Tue Jul 18 09:54:13 UTC 2023
Chris Lamb pushed to branch master at Reproducible Builds / diffoscope
Commits:
633bff8c by Chris Lamb at 2023-07-18T10:51:10+01:00
Move to using assert_diff in ICO and JPEG tests.
- - - - -
006f3dc2 by Chris Lamb at 2023-07-18T10:53:32+01:00
Don't include file size in image metadata; it is, at best, distracting and it is already in the directory metadata.
If the files have different sizes but are otherwise identical (ie. if the
image is being 'sneaky'), then this will be revealed in much better ways
by diffoscope already
- - - - -
6 changed files:
- diffoscope/comparators/image.py
- tests/comparators/test_ico_image.py
- tests/comparators/test_jpeg_image.py
- tests/data/ico_image_meta_expected_diff
- tests/data/ico_image_meta_expected_diff_v2
- tests/data/jpeg_image_meta_expected_diff
Changes:
=====================================
diffoscope/comparators/image.py
=====================================
@@ -47,7 +47,6 @@ class Img2Txt(Command):
class Identify(Command):
ATTRIBUTES = (
"Image format: %m",
- "File size: %b",
"Height: %[height]",
"Width: %[width]",
"Orientation: %[orientation]",
=====================================
tests/comparators/test_ico_image.py
=====================================
@@ -21,7 +21,7 @@ import pytest
from diffoscope.comparators.image import ICOImageFile
from diffoscope.config import Config
-from ..utils.data import load_fixture, get_data
+from ..utils.data import load_fixture, assert_diff
from ..utils.tools import (
skip_unless_tools_exist,
skip_unless_tool_is_between,
@@ -51,8 +51,7 @@ def differences(image1, image2):
@skip_unless_tools_exist("img2txt", "convert")
def test_diff(differences):
- expected_diff = get_data("ico_image_expected_diff")
- assert differences[0].unified_diff == expected_diff
+ assert_diff(differences[0], "ico_image_expected_diff")
@pytest.fixture
@@ -65,8 +64,7 @@ def differences_meta(image1_meta, image2_meta):
"identify", identify_version, "6.9.10-23", "7.0.0"
)
def test_diff_meta(differences_meta):
- expected_diff = get_data("ico_image_meta_expected_diff")
- assert differences_meta[-1].unified_diff == expected_diff
+ assert_diff(differences_meta[-1], "ico_image_meta_expected_diff")
@skip_unless_tools_exist("img2txt", "identify")
@@ -74,8 +72,7 @@ def test_diff_meta(differences_meta):
"identify", identify_version, "6.9.10-23", "7.0.0"
)
def test_diff_meta2(differences_meta):
- expected_diff = get_data("ico_image_meta_expected_diff_v2")
- assert differences_meta[-1].unified_diff == expected_diff
+ assert_diff(differences_meta[-1], "ico_image_meta_expected_diff_v2")
@skip_unless_tools_exist("img2txt", "convert", "identify")
=====================================
tests/comparators/test_jpeg_image.py
=====================================
@@ -23,7 +23,7 @@ from diffoscope.config import Config
from diffoscope.comparators.image import JPEGImageFile
from diffoscope.comparators.missing_file import MissingFile
-from ..utils.data import load_fixture, get_data
+from ..utils.data import load_fixture, assert_diff
from ..utils.tools import skip_unless_tools_exist, skip_unless_tool_is_between
@@ -58,8 +58,7 @@ def differences(image1, image2):
@skip_unless_tools_exist("img2txt", "identify")
def test_diff(differences):
- expected_diff = get_data("jpeg_image_expected_diff")
- assert differences[0].unified_diff == expected_diff
+ assert_diff(differences[0], "jpeg_image_expected_diff")
@skip_unless_tools_exist("img2txt", "identify")
@@ -78,8 +77,7 @@ def differences_meta(image1_meta, image2_meta):
@skip_unless_tools_exist("img2txt", "identify")
@skip_unless_tool_is_between("identify", identify_version, "6.9.6", "7.0.0")
def test_diff_meta(differences_meta):
- expected_diff = get_data("jpeg_image_meta_expected_diff")
- assert differences_meta[-1].unified_diff == expected_diff
+ assert_diff(differences_meta[-1], "jpeg_image_meta_expected_diff")
@skip_unless_tools_exist("img2txt", "convert", "identify")
=====================================
tests/data/ico_image_meta_expected_diff
=====================================
@@ -1,7 +1,4 @@
-@@ -1,17 +1,17 @@
- Image format: ICO
--File size: 6926B
-+File size: 3270B
+@@ -2,15 +2,15 @@
Height: 100
Width: 100
Orientation: Undefined
=====================================
tests/data/ico_image_meta_expected_diff_v2
=====================================
@@ -1,7 +1,4 @@
-@@ -1,17 +1,17 @@
- Image format: ICO
--File size: 6926B
-+File size: 3270B
+@@ -2,15 +2,15 @@
Height: 100
Width: 100
Orientation: Undefined
=====================================
tests/data/jpeg_image_meta_expected_diff
=====================================
@@ -1,7 +1,5 @@
-@@ -1,20 +1,20 @@
+@@ -1,19 +1,19 @@
Image format: JPEG
--File size: 662B
-+File size: 627B
Height: 100
Width: 100
Orientation: Undefined
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/68e2387030d3219fe107f87cd0631305d70cfb8c...006f3dc29b28cf131be225453981fc43b98481c3
--
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/68e2387030d3219fe107f87cd0631305d70cfb8c...006f3dc29b28cf131be225453981fc43b98481c3
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20230718/3f6b7410/attachment.htm>
More information about the rb-commits
mailing list