Skip to content

semver.satisfies is not working as expected #38

Description

@DmitrySokolov

Here is the output of semver.gte, semver.lt, semver.satisfies

20.12.1-0 gte 20.12.0-0 : True
20.12.1-0 lt  20.13.0-0 : True
20.12.1-0 >=20.12.0-0 <20.13.0-0 : False, expected True - failed

Test:

import semver

x = "20.12.0-0"
y = "20.13.0-0"
z = f">={x} <{y}"

for v in ["20.12.0-0","20.12.0-1","20.12.0","20.12.1-0","20.12.1-1","20.12.1","20.12.2-0","20.12.2-1","20.12.2","20.13.0-0","20.13.0-1","20.13.0"]:
    r1 = semver.gte(v, x, loose=True)
    r2 = semver.lt(v, y, loose=True)
    r3 = semver.satisfies(v, z)
    print(f"{v} gte {x} : {r1}")
    print(f"{v} lt  {y} : {r2}")
    print(f"{v} {z} : {r3}, expected {r1 and r2}{'' if (r1 and r2) == r3 else ' - failed'}")

if v >= min and v < max then satisfies should also return True.


> pip list
Package     Version
----------- -------
node-semver 0.8.0
pip         20.0.2
setuptools  45.2.0
wheel       0.34.2

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions