lib.version.Version.next(): Step the last part
Range expansion needs a bound that steps the last existing part of a version, add that. next() increments the last part, whatever it is: next of '1' is '2', of '1.0' is '1.1', of '1.2.3' is '1.2.4', of '1.2.3-45' is '1.2.3-46'. Tests written by AI. Signed-off-by: Jan Lindemann <jan@janware.com> Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.85.1
This commit is contained in:
parent
c23a2e4ab2
commit
83b5151f22
2 changed files with 48 additions and 0 deletions
|
|
@ -193,6 +193,29 @@ for spec in ['1.2.3-rc1', '1.2.3']:
|
|||
except Version.Error:
|
||||
pass
|
||||
|
||||
# next steps the last existing part, whatever it is
|
||||
for spec, expected in [
|
||||
('1', '2'),
|
||||
('1.0', '1.1'),
|
||||
('1.2.3', '1.2.4'),
|
||||
('1.2.3-45', '1.2.3-46'),
|
||||
('1.2.3-4blah', '1.2.3-5'),
|
||||
('1.2.3.4', '1.2.3.5'),
|
||||
('1.2.3rc1', '1.2.4'),
|
||||
('VERSION', '1.2.4'),
|
||||
]:
|
||||
v = Version('foo', spec, app.get_version)
|
||||
assert str(v.next) == expected, spec
|
||||
|
||||
# A last part without leading digits cannot be stepped
|
||||
for spec in ['1.0-rc1', '1.2.alpha']:
|
||||
v = Version('foo', spec)
|
||||
try:
|
||||
v.next
|
||||
assert False, f'Should have raised for {spec!r}'
|
||||
except Version.Error:
|
||||
pass
|
||||
|
||||
# constructor
|
||||
d = Dependency('foo-devel = 1.0')
|
||||
assert d.base_name == 'foo'
|
||||
|
|
|
|||
Loading…
Reference in a new issue