|
115 | 115 | (("2.0.0a4", "PATCH", "alpha", 0, None), "2.0.0a5"), |
116 | 116 | (("2.0.0a5", "MAJOR", "alpha", 0, None), "2.0.0a6"), |
117 | 117 | # |
| 118 | + (("2.0.0b0", "MINOR", "alpha", 0, None), "2.0.0b1"), |
| 119 | + (("2.0.0b0", "PATCH", "alpha", 0, None), "2.0.0b1"), |
| 120 | + # |
118 | 121 | (("1.0.1a0", "PATCH", None, 0, None), "1.0.1"), |
119 | 122 | (("1.0.1a0", "MINOR", None, 0, None), "1.1.0"), |
120 | 123 | (("1.0.1a0", "MAJOR", None, 0, None), "2.0.0"), |
|
141 | 144 | (("3.1.4a0", "MAJOR", "alpha", 0, None), "4.0.0a0"), |
142 | 145 | ] |
143 | 146 |
|
144 | | - |
145 | | -# test driven development |
146 | | -sortability = [ |
147 | | - "0.10.0a0", |
148 | | - "0.1.1", |
149 | | - "0.1.2", |
150 | | - "2.1.1", |
151 | | - "3.0.0", |
152 | | - "0.9.1a0", |
153 | | - "1.0.0a1", |
154 | | - "1.0.0b1", |
155 | | - "1.0.0a1", |
156 | | - "1.0.0a2.dev1", |
157 | | - "1.0.0rc2", |
158 | | - "1.0.0a3.dev0", |
159 | | - "1.0.0a2.dev0", |
160 | | - "1.0.0a3.dev1", |
161 | | - "1.0.0a2.dev0", |
162 | | - "1.0.0b0", |
163 | | - "1.0.0rc0", |
164 | | - "1.0.0rc1", |
| 147 | +excact_cases = [ |
| 148 | + (("1.0.0", "PATCH", None, 0, None), "1.0.1"), |
| 149 | + (("1.0.0", "MINOR", None, 0, None), "1.1.0"), |
| 150 | + # with exact_increment=False: "1.0.0b0" |
| 151 | + (("1.0.0a1", "PATCH", "beta", 0, None), "1.0.1b0"), |
| 152 | + # with exact_increment=False: "1.0.0b1" |
| 153 | + (("1.0.0b0", "PATCH", "beta", 0, None), "1.0.1b0"), |
| 154 | + # with exact_increment=False: "1.0.0rc0" |
| 155 | + (("1.0.0b1", "PATCH", "rc", 0, None), "1.0.1rc0"), |
| 156 | + # with exact_increment=False: "1.0.0-rc1" |
| 157 | + (("1.0.0rc0", "PATCH", "rc", 0, None), "1.0.1rc0"), |
| 158 | + # with exact_increment=False: "1.0.0rc1-dev1" |
| 159 | + (("1.0.0rc0", "PATCH", "rc", 0, 1), "1.0.1rc0.dev1"), |
| 160 | + # with exact_increment=False: "1.0.0b0" |
| 161 | + (("1.0.0a1", "MINOR", "beta", 0, None), "1.1.0b0"), |
| 162 | + # with exact_increment=False: "1.0.0b1" |
| 163 | + (("1.0.0b0", "MINOR", "beta", 0, None), "1.1.0b0"), |
| 164 | + # with exact_increment=False: "1.0.0b1" |
| 165 | + (("1.0.0b0", "MINOR", "alpha", 0, None), "1.1.0a0"), |
| 166 | + # with exact_increment=False: "1.0.0rc0" |
| 167 | + (("1.0.0b1", "MINOR", "rc", 0, None), "1.1.0rc0"), |
| 168 | + # with exact_increment=False: "1.0.0rc1" |
| 169 | + (("1.0.0rc0", "MINOR", "rc", 0, None), "1.1.0rc0"), |
| 170 | + # with exact_increment=False: "1.0.0rc1-dev1" |
| 171 | + (("1.0.0rc0", "MINOR", "rc", 0, 1), "1.1.0rc0.dev1"), |
| 172 | + # with exact_increment=False: "2.0.0" |
| 173 | + (("2.0.0b0", "MAJOR", None, 0, None), "3.0.0"), |
| 174 | + # with exact_increment=False: "2.0.0" |
| 175 | + (("2.0.0b0", "MINOR", None, 0, None), "2.1.0"), |
| 176 | + # with exact_increment=False: "2.0.0" |
| 177 | + (("2.0.0b0", "PATCH", None, 0, None), "2.0.1"), |
| 178 | + # same with exact_increment=False |
| 179 | + (("2.0.0b0", "MAJOR", "alpha", 0, None), "3.0.0a0"), |
| 180 | + # with exact_increment=False: "2.0.0b1" |
| 181 | + (("2.0.0b0", "MINOR", "alpha", 0, None), "2.1.0a0"), |
| 182 | + # with exact_increment=False: "2.0.0b1" |
| 183 | + (("2.0.0b0", "PATCH", "alpha", 0, None), "2.0.1a0"), |
165 | 184 | ] |
166 | 185 |
|
167 | 186 |
|
@@ -194,6 +213,27 @@ def test_bump_pep440_version(test_input, expected): |
194 | 213 | ) |
195 | 214 |
|
196 | 215 |
|
| 216 | +@pytest.mark.parametrize("test_input, expected", excact_cases) |
| 217 | +def test_bump_pep440_version_force(test_input, expected): |
| 218 | + current_version = test_input[0] |
| 219 | + increment = test_input[1] |
| 220 | + prerelease = test_input[2] |
| 221 | + prerelease_offset = test_input[3] |
| 222 | + devrelease = test_input[4] |
| 223 | + assert ( |
| 224 | + str( |
| 225 | + Pep440(current_version).bump( |
| 226 | + increment=increment, |
| 227 | + prerelease=prerelease, |
| 228 | + prerelease_offset=prerelease_offset, |
| 229 | + devrelease=devrelease, |
| 230 | + exact_increment=True, |
| 231 | + ) |
| 232 | + ) |
| 233 | + == expected |
| 234 | + ) |
| 235 | + |
| 236 | + |
197 | 237 | @pytest.mark.parametrize("test_input,expected", local_versions) |
198 | 238 | def test_bump_pep440_version_local(test_input, expected): |
199 | 239 | current_version = test_input[0] |
|
0 commit comments