Whole file

rbarrois/python-semanticversion

The author described this change as Fix handling pre-1.0.0 caret versions (Closes #35). It counts as a record because the check below fails on the code as it stood at 9872b3940 and passes on d10ab4cb1, with nothing else changed between the two runs.

Fix saved2016-02-21
Sharing licenceBSD-2-Clause · LICENSE
Change size+7 1

What the code was meant to do, written into the code itself as a save note

Fix handling pre-1.0.0 caret versions (Closes #35)

The change

459459 elif self.kind == self.KIND_NEQ:
460460 return version != self.spec
461461 elif self.kind == self.KIND_CARET:
462- return self.spec <= version < self.spec.next_major()
462+ if self.spec.major != 0:
463+ upper = self.spec.next_major()
464+ elif self.spec.minor != 0:
465+ upper = self.spec.next_minor()
466+ else:
467+ upper = self.spec.next_patch()
468+ return self.spec <= version < upper
463469 elif self.kind == self.KIND_TILDE:
464470 return self.spec <= version < self.spec.next_minor()
465471 else: # pragma: no cover

The check that tells the two apart

failpass·tests/test_base.py::SpecItemTestCase::test_matches

Check file tests/test_base.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before it9872b3940e87d1d810560ea4381929554fd8038c
Broken version dated2016-02-21
Modulesemantic_version.base
Units changedSpecItem
Fingerprint86baf6e735df6cae
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.