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 @@ -558,7 +558,7 @@ def of(cls, *markers: BaseMarker) -> MarkerTypes:
558
558
continue
559
559
560
560
if isinstance (marker , SingleMarker ) and marker .name == "python_version" :
561
- intersected = False
561
+ overlapped = False
562
562
for i , mark in enumerate (markers ):
563
563
if (
564
564
not isinstance (mark , SingleMarker )
@@ -567,16 +567,18 @@ def of(cls, *markers: BaseMarker) -> MarkerTypes:
567
567
):
568
568
continue
569
569
570
- intersection = mark .constraint .union (marker .constraint )
571
- if intersection == mark .constraint :
572
- intersected = True
570
+ union = mark .constraint .union (marker .constraint )
571
+ if union == mark .constraint :
572
+ overlapped = True
573
573
break
574
- elif intersection == marker .constraint :
574
+ elif union == marker .constraint :
575
575
markers [i ] = marker
576
- intersected = True
576
+ overlapped = True
577
577
break
578
+ elif union .is_any ():
579
+ return AnyMarker ()
578
580
579
- if intersected :
581
+ if overlapped :
580
582
continue
581
583
582
584
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