File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -561,7 +561,7 @@ def of(cls, *markers: BaseMarker) -> MarkerTypes:
561561 continue
562562
563563 if isinstance (marker , SingleMarker ) and marker .name == "python_version" :
564- intersected = False
564+ included = False
565565 for i , mark in enumerate (markers ):
566566 if (
567567 not isinstance (mark , SingleMarker )
@@ -570,16 +570,18 @@ def of(cls, *markers: BaseMarker) -> MarkerTypes:
570570 ):
571571 continue
572572
573- intersection = mark .constraint .union (marker .constraint )
574- if intersection == mark .constraint :
575- intersected = True
573+ union = mark .constraint .union (marker .constraint )
574+ if union == mark .constraint :
575+ included = True
576576 break
577- elif intersection == marker .constraint :
577+ elif union == marker .constraint :
578578 markers [i ] = marker
579- intersected = True
579+ included = True
580580 break
581+ elif union .is_any ():
582+ return AnyMarker ()
581583
582- if intersected :
584+ if included :
583585 continue
584586
585587 markers .append (marker )
Original file line number Diff line number Diff line change @@ -162,16 +162,13 @@ def test_single_marker_not_in_python_intersection():
162162def test_single_marker_union ():
163163 m = parse_marker ('sys_platform == "darwin"' )
164164
165- intersection = m .union (parse_marker ('implementation_name == "cpython"' ))
166- assert (
167- str (intersection )
168- == 'sys_platform == "darwin" or implementation_name == "cpython"'
169- )
165+ union = m .union (parse_marker ('implementation_name == "cpython"' ))
166+ assert str (union ) == 'sys_platform == "darwin" or implementation_name == "cpython"'
170167
171168 m = parse_marker ('python_version >= "3.4"' )
172169
173- intersection = m .union (parse_marker ('python_version < "3.6"' ))
174- assert str ( intersection ) == 'python_version >= "3.4" or python_version < "3.6"'
170+ union = m .union (parse_marker ('python_version < "3.6"' ))
171+ assert union . is_any ()
175172
176173
177174def test_single_marker_union_compacts_constraints ():
You can’t perform that action at this time.
0 commit comments