Compare commits
2 commits
69a83ea47f
...
55102f7b43
| Author | SHA1 | Date | |
|---|---|---|---|
| 55102f7b43 | |||
| b0a8d87d4f |
4 changed files with 22 additions and 5 deletions
|
|
@ -5,6 +5,12 @@ All notable changes to WuttJamaican will be documented in this file.
|
||||||
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
||||||
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## v0.28.8 (2026-02-25)
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- diff should use "intersection" of fields by default
|
||||||
|
|
||||||
## v0.28.7 (2026-02-17)
|
## v0.28.7 (2026-02-17)
|
||||||
|
|
||||||
### Fix
|
### Fix
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ build-backend = "hatchling.build"
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "WuttJamaican"
|
name = "WuttJamaican"
|
||||||
version = "0.28.7"
|
version = "0.28.8"
|
||||||
description = "Base package for Wutta Framework"
|
description = "Base package for Wutta Framework"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = [{name = "Lance Edgar", email = "lance@wuttaproject.org"}]
|
authors = [{name = "Lance Edgar", email = "lance@wuttaproject.org"}]
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,11 @@ class Diff: # pylint: disable=too-many-instance-attributes
|
||||||
self.cell_padding = cell_padding
|
self.cell_padding = cell_padding
|
||||||
|
|
||||||
def make_fields(self): # pylint: disable=missing-function-docstring
|
def make_fields(self): # pylint: disable=missing-function-docstring
|
||||||
return sorted(set(self.old_data) | set(self.new_data), key=lambda x: x.lower())
|
if self.old_data and self.new_data:
|
||||||
|
fields = set(self.old_data) & set(self.new_data)
|
||||||
|
else:
|
||||||
|
fields = set(self.old_data or self.new_data)
|
||||||
|
return sorted(fields, key=lambda f: f.lower())
|
||||||
|
|
||||||
def render_html(self, template=None, **kwargs):
|
def render_html(self, template=None, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -19,13 +19,20 @@ class TestDiff(ConfigTestCase):
|
||||||
self.assertEqual(diff.cell_padding, "0.5rem")
|
self.assertEqual(diff.cell_padding, "0.5rem")
|
||||||
|
|
||||||
def test_make_fields(self):
|
def test_make_fields(self):
|
||||||
old_data = {"foo": "bar"}
|
|
||||||
new_data = {"foo": "bar", "baz": "zer"}
|
# should return "sorted intersection" of fields
|
||||||
|
old_data = {"foo": "bar", "baz": "abc"}
|
||||||
|
new_data = {"foo": "bar", "baz": "xyz", "flurg": "foo"}
|
||||||
# nb. this calls make_fields()
|
# nb. this calls make_fields()
|
||||||
diff = self.make_diff(old_data, new_data)
|
diff = self.make_diff(old_data, new_data)
|
||||||
# TODO: should the fields be cumulative? or just use new_data?
|
|
||||||
self.assertEqual(diff.fields, ["baz", "foo"])
|
self.assertEqual(diff.fields, ["baz", "foo"])
|
||||||
|
|
||||||
|
# all fields are used if only one data set
|
||||||
|
diff = self.make_diff(old_data, {})
|
||||||
|
self.assertEqual(diff.fields, ["baz", "foo"])
|
||||||
|
diff = self.make_diff({}, new_data)
|
||||||
|
self.assertEqual(diff.fields, ["baz", "flurg", "foo"])
|
||||||
|
|
||||||
def test_values(self):
|
def test_values(self):
|
||||||
old_data = {"foo": "bar"}
|
old_data = {"foo": "bar"}
|
||||||
new_data = {"foo": "baz"}
|
new_data = {"foo": "baz"}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue