Skip to content

Commit 8f2c0c5

Browse files
committed
add tests for inclusive matches
1 parent 704fa64 commit 8f2c0c5

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

python/private/py_wheel_normalize_pep440.bzl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,12 +609,16 @@ def _version_gt(left, right):
609609
def _version_ge(left, right):
610610
# PEP440: simple order check
611611
# https://peps.python.org/pep-0440/#inclusive-ordered-comparison
612-
return left.key(local = False) >= right.key(local = False)
612+
_left = left.key(local = False)
613+
_right = right.key(local = False)
614+
return _left >= _right
613615

614616
def _version_le(left, right):
615617
# PEP440: simple order check
616618
# https://peps.python.org/pep-0440/#inclusive-ordered-comparison
617-
return left.key(local = False) <= right.key(local = False)
619+
_left = left.key(local = False)
620+
_right = right.key(local = False)
621+
return _left <= _right
618622

619623
def _first_non_none(*args):
620624
for arg in args:

tests/pypi/pep508/evaluate_tests.bzl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,11 @@ _MISC_EXPRESSIONS = [
292292
_expr_case('python_version < "1.7.1"', False, {"python_version": "1.7.1-rc2"}),
293293
_expr_case('python_version < "1.7.1-rc3"', True, {"python_version": "1.7.1-rc2"}),
294294
_expr_case('python_version < "1.7.1-rc1"', False, {"python_version": "1.7.1-rc2"}),
295+
# Extra tests
296+
_expr_case('python_version <= "1.7.1"', True, {"python_version": "1.7.1"}),
297+
_expr_case('python_version <= "1.7.2"', True, {"python_version": "1.7.1"}),
298+
_expr_case('python_version >= "1.7.1"', True, {"python_version": "1.7.1"}),
299+
_expr_case('python_version >= "1.7.0"', True, {"python_version": "1.7.1"}),
295300
]
296301

297302
def _misc_expressions(env):

0 commit comments

Comments
 (0)