diff --git a/NEWS.rst b/NEWS.rst index fe8f1a9a9..a32189843 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -1,5 +1,6 @@ - [designspaceLib] Fixed typo in ``deepcopyExceptFonts`` method, preventing font - references to be transferred (#2600). + references to be transferred (#2600). Fixed another typo in the name of ``Range`` + dataclass's ``__post_init__`` magic method (#2597). 4.33.2 (released 2022-04-22) ---------------------------- diff --git a/Tests/designspaceLib/designspace_test.py b/Tests/designspaceLib/designspace_test.py index bdf1ef137..ee2d19e63 100644 --- a/Tests/designspaceLib/designspace_test.py +++ b/Tests/designspaceLib/designspace_test.py @@ -18,6 +18,7 @@ from fontTools.designspaceLib import ( posix, processRules, ) +from fontTools.designspaceLib.types import Range from fontTools.misc import plistlib @@ -1055,3 +1056,11 @@ def test_deepcopyExceptFonts(): assert ds.tostring() == ds_copy.tostring() assert ds.sources[0].font is ds_copy.sources[0].font assert ds.sources[1].font is ds_copy.sources[1].font + + +def test_Range_post_init(): + # test min and max are sorted and default is clamped to either min/max + r = Range(minimum=2, maximum=-1, default=-2) + assert r.minimum == -1 + assert r.maximum == 2 + assert r.default == -1