Add tests for CargoSemVer.eval_

There are logic errors in `KIND_GTE` and `KIND_LTE`, surface them with
the new test

Signed-off-by: Michel Alexandre Salim <salimma@fedoraproject.org>
This commit is contained in:
Michel Alexandre Salim 2022-10-31 12:53:38 -05:00
parent 09a496c65e
commit 1869f5a7e0
No known key found for this signature in database
GPG key ID: 8B229D2F7CCC04F2

View file

@ -145,6 +145,20 @@ def test_coerce(version, coerced_version):
assert result == coerced_version assert result == coerced_version
@pytest.mark.parametrize(
"v1, op, v2, expected",
[
(Version(0, 2, 2, None, None), CargoSemVer.KIND_GT, Version(0, 3, 5, None, None), False),
(Version(0, 2, 2, None, None), CargoSemVer.KIND_GTE, Version(0, 3, 5, None, None), False),
(Version(0, 3, 5, None, None), CargoSemVer.KIND_LT, Version(0, 2, 2, None, None), False),
(Version(0, 3, 5, None, None), CargoSemVer.KIND_LTE, Version(0, 2, 2, None, None), False),
],
)
def test_eval(v1, op, v2, expected):
result = CargoSemVer.eval_(v1, op, v2)
assert result == expected
@pytest.mark.parametrize( @pytest.mark.parametrize(
"version, next_version", "version, next_version",
[ [