lib.version.Dependency.__version_boundaries(): Use Version.next()
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m42s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m43s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 4m30s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m29s
CI / Packaging test (push) Successful in 0s

Use Version.next() in __version_boundaries, which steps the last existing
part, so '= 1.0' spans '>= 1.0, < 1.1'.

Tests written by AI.

Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.85.1
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-09-15 19:58:24 +02:00
commit 3f00f4a416
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61
2 changed files with 21 additions and 11 deletions

View file

@ -109,7 +109,7 @@ assert d.constraint_str() == 'foo = 1.2.3'
assert d.constraint_str() == 'foo = 1.2.3'
assert calls == ['foo']
# as_range expands a non-full boundary into the range it spans
# as_range expands a non-full = boundary into the range it spans
d = Dependency('foo = VERSION-REVISION', app.get_version)
assert d.constraint_str(as_range = True) == 'foo = 1.2.3-45'
d = Dependency('foo >= VERSION-REVISION', app.get_version)
@ -123,14 +123,22 @@ assert constraint == 'foo = VERSION-REVISION'
# A full version stays exact; a non-full one expands
d = Dependency('foo = VERSION', app.get_version)
assert d.constraint_str(as_range = True) == 'foo >= 1.2.3, foo < 1.2.4'
# Operators other than = pass through unchanged
d = Dependency('foo >= VERSION', app.get_version)
assert d.constraint_str(as_range = True) == 'foo >= 1.2.3, foo < 1.2.4'
# '<' and '<=' are not expanded
assert d.constraint_str(as_range = True) == 'foo >= 1.2.3'
d = Dependency('foo <= VERSION', app.get_version)
assert d.constraint_str(as_range = True) == 'foo <= 1.2.3'
# The bound steps a micro, so a tripartite core expands
# The bound steps the last part, whatever it is
d = Dependency('foo = 1.0', app.get_version)
assert d.constraint_str(as_range = True) == 'foo >= 1.0, foo < 1.1'
d = Dependency('foo = 1.2.3', app.get_version)
assert d.constraint_str(as_range = True) == 'foo >= 1.2.3, foo < 1.2.4'
d = Dependency('foo = 1.2.3rc1', app.get_version)
assert d.constraint_str(as_range = True) == 'foo >= 1.2.3rc1, foo < 1.2.4'
# A last part without leading digits cannot be stepped, so the pin
# stays exact
d = Dependency('foo = 1.0-rc1', app.get_version)
assert d.constraint_str(as_range = True) == 'foo = 1.0-rc1'
# Default syntax is SEM_VER
d = Dependency('foo < 2.0')
assert d.constraint_str(untemplated = False) == 'foo < 2.0'