File tree 2 files changed +13
-14
lines changed
2 files changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -561,7 +561,7 @@ def of(cls, *markers: BaseMarker) -> MarkerTypes:
561
561
continue
562
562
563
563
if isinstance (marker , SingleMarker ) and marker .name == "python_version" :
564
- intersected = False
564
+ included = False
565
565
for i , mark in enumerate (markers ):
566
566
if (
567
567
not isinstance (mark , SingleMarker )
@@ -570,16 +570,18 @@ def of(cls, *markers: BaseMarker) -> MarkerTypes:
570
570
):
571
571
continue
572
572
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
576
576
break
577
- elif intersection == marker .constraint :
577
+ elif union == marker .constraint :
578
578
markers [i ] = marker
579
- intersected = True
579
+ included = True
580
580
break
581
+ elif union .is_any ():
582
+ return AnyMarker ()
581
583
582
- if intersected :
584
+ if included :
583
585
continue
584
586
585
587
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():
162
162
def test_single_marker_union ():
163
163
m = parse_marker ('sys_platform == "darwin"' )
164
164
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"'
170
167
171
168
m = parse_marker ('python_version >= "3.4"' )
172
169
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 ()
175
172
176
173
177
174
def test_single_marker_union_compacts_constraints ():
You can’t perform that action at this time.
0 commit comments