Background
PR #6 (#6) introduced create_labels/sync.py, which normalises remote GitHub label fields (colour uppercasing, description trimming) before comparing them with the desired LabelSpec. Normalisation invariants are enforced in LabelSpec.__post_init__ but no property-based tests verify that sync_labels returns "unchanged" for the full space of denormalised GitHub responses that are semantically equivalent after normalisation.
Required work
- Add
hypothesis to the [dependency-groups].dev section of pyproject.toml.
- Add property tests in
tests/test_sync.py (or a new tests/test_sync_properties.py) that use @given strategies to generate:
- arbitrary lowercase/mixed-case six-character hex colour strings (with and without a leading
#);
- arbitrary description strings with leading/trailing whitespace.
- Assert that
sync_labels returns LabelSyncResult(name, "unchanged") and makes no update calls whenever the normalised remote values match the configured LabelSpec.
Acceptance criteria
hypothesis is declared as a dev dependency.
- At least one
@given-decorated test verifies colour-case idempotency.
- At least one
@given-decorated test verifies description-whitespace idempotency.
make test passes with the new property tests included.
Raised by @leynos following review of PR #6.
Background
PR #6 (#6) introduced
create_labels/sync.py, which normalises remote GitHub label fields (colour uppercasing, description trimming) before comparing them with the desiredLabelSpec. Normalisation invariants are enforced inLabelSpec.__post_init__but no property-based tests verify thatsync_labelsreturns"unchanged"for the full space of denormalised GitHub responses that are semantically equivalent after normalisation.Required work
hypothesisto the[dependency-groups].devsection ofpyproject.toml.tests/test_sync.py(or a newtests/test_sync_properties.py) that use@givenstrategies to generate:#);sync_labelsreturnsLabelSyncResult(name, "unchanged")and makes no update calls whenever the normalised remote values match the configuredLabelSpec.Acceptance criteria
hypothesisis declared as a dev dependency.@given-decorated test verifies colour-case idempotency.@given-decorated test verifies description-whitespace idempotency.make testpasses with the new property tests included.Raised by @leynos following review of PR #6.