Q105 pointed beam/CHECK at pytest; pytest is not installed on this interpreter, so the gate exited 2 and ran zero cells. run_lane_tests.py collects TestCase classes (TestLoader) and bare module-level def test_*() (FunctionTestCase) itself, treats an unimportable module and a printed FAIL transcript as faults, and exits 0/1/2. Four test files that imported pytest now use beam_assert.raises/fail and unittest.mock; no cell dropped. Measured: unittest discover 353 tests; runner 570 (353 + 217 bare); bash wizard-work/beam/CHECK rc 0; test_run_lane_tests.py 10 cells OK; 7-mutant battery in scratch copies all as expected (HEAD CHECK rc 2, broken bare rc 1, pytest import rc 1, failing TestCase rc 1, script FAIL rc 1, empty lane rc 2, control rc 0). Record: WORK-QUEUE.md Q128; report wizard-outputs/volt/2026-10-30-q128.md
51 lines
1.9 KiB
Python
51 lines
1.9 KiB
Python
from beam_assert import raises
|
|
from semver import SemVer, SemVerError
|
|
|
|
def test_parse_basic():
|
|
v = SemVer.parse("1.2.3")
|
|
assert (v.major, v.minor, v.patch) == (1,2,3)
|
|
assert v.pre == () and v.build == ()
|
|
|
|
def test_str_roundtrip():
|
|
for s in ["1.2.3", "1.2.3-rc.1", "1.2.3+build.5", "1.2.3-rc.1+build.5", "0.0.0"]:
|
|
assert str(SemVer.parse(s)) == s
|
|
|
|
def test_prerelease_order():
|
|
assert SemVer.parse("1.0.0-alpha") < SemVer.parse("1.0.0-alpha.1")
|
|
assert SemVer.parse("1.0.0-alpha.1") < SemVer.parse("1.0.0-alpha.beta")
|
|
assert SemVer.parse("1.0.0-alpha.beta") < SemVer.parse("1.0.0-beta")
|
|
assert SemVer.parse("1.0.0-beta") < SemVer.parse("1.0.0-beta.2")
|
|
assert SemVer.parse("1.0.0-beta.2") < SemVer.parse("1.0.0-beta.11")
|
|
assert SemVer.parse("1.0.0-beta.11") < SemVer.parse("1.0.0-rc.1")
|
|
assert SemVer.parse("1.0.0-rc.1") < SemVer.parse("1.0.0")
|
|
|
|
def test_numeric_vs_string_id():
|
|
# numeric identifiers always have lower precedence than non-numeric
|
|
assert SemVer.parse("1.0.0-1") < SemVer.parse("1.0.0-alpha")
|
|
|
|
def test_build_ignored_equality():
|
|
assert SemVer.parse("1.0.0+foo") == SemVer.parse("1.0.0+bar")
|
|
assert hash(SemVer.parse("1.0.0+foo")) == hash(SemVer.parse("1.0.0+bar"))
|
|
|
|
def test_leading_zero_rejected():
|
|
with raises(SemVerError):
|
|
SemVer.parse("1.0.0-01")
|
|
with raises(SemVerError):
|
|
SemVer.parse("1.0.0+01")
|
|
|
|
def test_invalid():
|
|
for s in ["", "1.2", "1.2.3.4", "a.b.c", "1.2.3-", " 1.2.3", "1.2.3 "]:
|
|
with raises(SemVerError):
|
|
SemVer.parse(s)
|
|
|
|
def test_bump():
|
|
v = SemVer.parse("1.2.3-rc.1+build")
|
|
assert str(v.bump("patch")) == "1.2.4"
|
|
assert str(v.bump("minor")) == "1.3.0"
|
|
assert str(v.bump("major")) == "2.0.0"
|
|
|
|
def test_sort():
|
|
versions = ["1.0.0", "2.0.0", "1.0.0-rc.1", "1.5.0", "1.0.0-alpha"]
|
|
parsed = sorted(SemVer.parse(x) for x in versions)
|
|
assert [str(x) for x in parsed] == ["1.0.0-alpha", "1.0.0-rc.1", "1.0.0", "1.5.0", "2.0.0"]
|