Skip to content

Commit

Permalink
additional testcases
Browse files Browse the repository at this point in the history
  • Loading branch information
dimbleby committed Nov 27, 2022
1 parent 86bfb8e commit 466090c
Showing 1 changed file with 34 additions and 8 deletions.
42 changes: 34 additions & 8 deletions tests/version/test_markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1311,14 +1311,40 @@ def test_single_markers_are_found_in_complex_intersection() -> None:
)


def test_empty_marker_is_found_in_complex_intersection() -> None:
m1 = parse_marker(
'(platform_system != "Windows" or platform_machine != "x86") and python_version'
' == "3.8"'
)
m2 = parse_marker('platform_system == "Windows" and platform_machine == "x86"')
intersection = m1.intersect(m2)
assert intersection.is_empty()
@pytest.mark.parametrize(
"marker1, marker2",
[
(
(
'(platform_system != "Windows" or platform_machine != "x86") and'
' python_version == "3.8"'
),
'platform_system == "Windows" and platform_machine == "x86"',
),
# Following example via
# https://github.com/python-poetry/poetry-plugin-export/issues/163
(
(
'python_version >= "3.8" and python_version < "3.11" and'
' (python_version > "3.9" or platform_system != "Windows" or'
' platform_machine != "x86") or python_version >= "3.11" and'
' python_version < "3.12"'
),
(
'python_version == "3.8" and platform_system == "Windows" and'
' platform_machine == "x86" or python_version == "3.9" and'
' platform_system == "Windows" and platform_machine == "x86"'
),
),
],
)
def test_empty_marker_is_found_in_complex_intersection(
marker1: str, marker2: str
) -> None:
m1 = parse_marker(marker1)
m2 = parse_marker(marker2)
assert m1.intersect(m2).is_empty()
assert m2.intersect(m1).is_empty()


@pytest.mark.parametrize(
Expand Down

0 comments on commit 466090c

Please sign in to comment.