83
83
(("1.0.0-alpha1" , None , "alpha" , 0 , None ), "1.0.0-a2" ),
84
84
]
85
85
86
+ excact_cases = [
87
+ (("1.0.0" , "PATCH" , None , 0 , None ), "1.0.1" ),
88
+ (("1.0.0" , "MINOR" , None , 0 , None ), "1.1.0" ),
89
+ # with exact_mode=False: "1.0.0-b0"
90
+ (("1.0.0a1" , "PATCH" , "beta" , 0 , None ), "1.0.1-b0" ),
91
+ # with exact_mode=False: "1.0.0-b1"
92
+ (("1.0.0b0" , "PATCH" , "beta" , 0 , None ), "1.0.1-b0" ),
93
+ # with exact_mode=False: "1.0.0-rc0"
94
+ (("1.0.0b1" , "PATCH" , "rc" , 0 , None ), "1.0.1-rc0" ),
95
+ # with exact_mode=False: "1.0.0-rc1"
96
+ (("1.0.0rc0" , "PATCH" , "rc" , 0 , None ), "1.0.1-rc0" ),
97
+ # with exact_mode=False: "1.0.0-rc1-dev1"
98
+ (("1.0.0rc0" , "PATCH" , "rc" , 0 , 1 ), "1.0.1-rc0-dev1" ),
99
+ # with exact_mode=False: "1.0.0-b0"
100
+ (("1.0.0a1" , "MINOR" , "beta" , 0 , None ), "1.1.0-b0" ),
101
+ # with exact_mode=False: "1.0.0-b1"
102
+ (("1.0.0b0" , "MINOR" , "beta" , 0 , None ), "1.1.0-b0" ),
103
+ # with exact_mode=False: "1.0.0-rc0"
104
+ (("1.0.0b1" , "MINOR" , "rc" , 0 , None ), "1.1.0-rc0" ),
105
+ # with exact_mode=False: "1.0.0-rc1"
106
+ (("1.0.0rc0" , "MINOR" , "rc" , 0 , None ), "1.1.0-rc0" ),
107
+ # with exact_mode=False: "1.0.0-rc1-dev1"
108
+ (("1.0.0rc0" , "MINOR" , "rc" , 0 , 1 ), "1.1.0-rc0-dev1" ),
109
+ ]
110
+
86
111
87
112
@pytest .mark .parametrize (
88
113
"test_input, expected" ,
@@ -107,6 +132,27 @@ def test_bump_semver_version(test_input, expected):
107
132
)
108
133
109
134
135
+ @pytest .mark .parametrize ("test_input, expected" , excact_cases )
136
+ def test_bump_semver_version_force (test_input , expected ):
137
+ current_version = test_input [0 ]
138
+ increment = test_input [1 ]
139
+ prerelease = test_input [2 ]
140
+ prerelease_offset = test_input [3 ]
141
+ devrelease = test_input [4 ]
142
+ assert (
143
+ str (
144
+ SemVer (current_version ).bump (
145
+ increment = increment ,
146
+ prerelease = prerelease ,
147
+ prerelease_offset = prerelease_offset ,
148
+ devrelease = devrelease ,
149
+ exact_mode = True ,
150
+ )
151
+ )
152
+ == expected
153
+ )
154
+
155
+
110
156
@pytest .mark .parametrize ("test_input,expected" , local_versions )
111
157
def test_bump_semver_version_local (test_input , expected ):
112
158
current_version = test_input [0 ]
0 commit comments