@@ -81,6 +81,7 @@ def v300b1() -> Version:
81
81
@pytest .mark .parametrize (
82
82
("constraint" , "check_version" , "allowed" ),
83
83
[
84
+ # Inclusive ordering
84
85
("<=3.0.0" , "3.0.0+local.1" , True ),
85
86
(">=3.0.0" , "3.0.0+local.1" , True ),
86
87
(">=3.0.0" , "3.0.0-1" , True ),
@@ -114,6 +115,28 @@ def v300b1() -> Version:
114
115
(">=3.0.0-1+local.1" , "3.0.0-1" , False ),
115
116
("<=3.0.0-2" , "3.0.0-1" , True ),
116
117
(">=3.0.0-2" , "3.0.0-1" , False ),
118
+ # Exclusive ordering
119
+ (">1.7" , "1.7.1" , True ),
120
+ (">1.7" , "1.6.1" , False ),
121
+ ("<1.7" , "1.7.1" , False ),
122
+ ("<1.7" , "1.6.1" , True ),
123
+ ## >V MUST NOT allow a post-release of the given version unless V itself is a post release
124
+ (">1.7" , "1.7.0.post1" , False ),
125
+ (">1.7.post2" , "1.7.0" , False ),
126
+ (">1.7.post2" , "1.7.1" , True ),
127
+ (">1.7.post2" , "1.7.0.post2" , False ),
128
+ (">1.7.post2" , "1.7.0.post3" , True ),
129
+ ## >V MUST NOT match a local version of the specified version
130
+ (">1.7.0" , "1.7.0+local.1" , False ),
131
+ ("<1.7.0" , "1.7.0+local.1" , False ), # spec does not clarify this
132
+ ("<1.7.0+local.2" , "1.7.0+local.1" , False ), # spec does not clarify this
133
+ ## <V MUST NOT allow a pre-release of the specified version unless the specified version is itself a pre-release
134
+ ("<1.7.0" , "1.7.0.rc1" , False ),
135
+ ("<1.7.0.rc1" , "1.7.0.rc1" , False ),
136
+ ("<1.7.0.rc2" , "1.7.0.rc1" , True ),
137
+ # Misc. Cases
138
+ (">=3.0.0+cuda" , "3.0.0+cuda" , True ),
139
+ (">=3.0.0+cpu" , "3.0.0+cuda" , True ), # cuda > cpu (lexicographically)
117
140
],
118
141
)
119
142
def test_version_ranges (constraint : str , check_version : str , allowed : bool ) -> None :
0 commit comments