Skip to content
Snippets Groups Projects
Commit 0c907dc8 authored by Chris Lamb's avatar Chris Lamb :eyes:
Browse files

When pretty-printing JSON, mark the difference as such, additionally avoiding...

When pretty-printing JSON, mark the difference as such, additionally avoiding including the full path. (Closes: #205)
parent 592c401b
No related branches found
Tags 215
No related merge requests found
Pipeline #315088 passed
......@@ -58,7 +58,11 @@ class JSONFile(File):
def compare_details(self, other, source=None):
difference = Difference.from_text(
self.dumps(self), self.dumps(other), self.path, other.path
self.dumps(self),
self.dumps(other),
self.path,
other.path,
source="Pretty-printed",
)
if difference:
......@@ -71,6 +75,7 @@ class JSONFile(File):
self.dumps(other, sort_keys=False),
self.path,
other.path,
source="Pretty-printed",
comment="ordering differences only",
)
......
......@@ -32,4 +32,7 @@ def assert_non_existing(
assert difference.source2 == "/nonexisting"
assert not has_details or len(difference.details) > 0
assert not has_null_source or difference.details[-1].source2 == "/dev/null"
assert not has_null_source or (
difference.details[-1].source2 == "/dev/null"
or difference.source2 == "/nonexisting"
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment