diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7142d156..277f7977 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -71,7 +71,7 @@ jobs: file: coverage.xml flags: unittests name: codecov-umbrella - fail_ci_if_error: true + fail_ci_if_error: false deploy: # only run if the commit is tagged... diff --git a/src/ufoLib2/objects/guideline.py b/src/ufoLib2/objects/guideline.py index 2697b459..ee221104 100644 --- a/src/ufoLib2/objects/guideline.py +++ b/src/ufoLib2/objects/guideline.py @@ -17,13 +17,13 @@ class Guideline(AttrDictMixin): data composition restrictions. """ - x: Optional[float] = None + x: float = 0 """The origin x coordinate of the guideline.""" - y: Optional[float] = None + y: float = 0 """The origin y coordinate of the guideline.""" - angle: Optional[float] = None + angle: float = 0 """The angle of the guideline.""" name: Optional[str] = None @@ -36,13 +36,5 @@ class Guideline(AttrDictMixin): """The globally unique identifier of the guideline.""" def __attrs_post_init__(self) -> None: - x, y, angle = self.x, self.y, self.angle - if x is None and y is None: - raise ValueError("x or y must be present") - if x is None or y is None: - if angle is not None: - raise ValueError("if 'x' or 'y' are None, 'angle' must not be present") - if x is not None and y is not None and angle is None: - raise ValueError("if 'x' and 'y' are defined, 'angle' must be defined") - if angle is not None and not (0 <= angle <= 360): + if not (0 <= self.angle <= 360): raise ValueError("angle must be between 0 and 360") diff --git a/tests/test_converters.py b/tests/test_converters.py index 047a43e7..85746f38 100644 --- a/tests/test_converters.py +++ b/tests/test_converters.py @@ -110,7 +110,11 @@ ], }, ), - (Guideline(x=0, name="foo"), {"x": 0, "name": "foo"}), + (Guideline(x=0, name="foo"), {"name": "foo"}), + ( + Guideline(x=149, y=1523, identifier="aaa"), + {"x": 149, "y": 1523, "identifier": "aaa"}, + ), (Guideline(y=1, name="bar"), {"y": 1, "name": "bar"}), ( Guideline(