2
2
3
3
import pytest
4
4
from bumpversion .versioning .models import VersionSpec
5
- from bumpversion .versioning .models import VersionComponentConfig
5
+ from bumpversion .versioning .models import VersionComponentSpec
6
6
7
7
8
8
class TestVersionSpec :
@@ -21,9 +21,9 @@ def test_empty_order_uses_order_of_components(self):
21
21
"""If the order is empty, it uses the component order."""
22
22
# Arrange
23
23
config = {
24
- "major" : VersionComponentConfig (),
25
- "minor" : VersionComponentConfig (),
26
- "patch" : VersionComponentConfig (),
24
+ "major" : VersionComponentSpec (),
25
+ "minor" : VersionComponentSpec (),
26
+ "patch" : VersionComponentSpec (),
27
27
}
28
28
29
29
# Act
@@ -36,9 +36,9 @@ def test_extra_items_raises_error(self):
36
36
"""If the order contains component names that do not exist, it raises and error."""
37
37
# Arrange
38
38
config = {
39
- "major" : VersionComponentConfig (),
40
- "minor" : VersionComponentConfig (),
41
- "patch" : VersionComponentConfig (),
39
+ "major" : VersionComponentSpec (),
40
+ "minor" : VersionComponentSpec (),
41
+ "patch" : VersionComponentSpec (),
42
42
}
43
43
44
44
# Act
@@ -49,9 +49,9 @@ def test_subset_of_items_works_fine(self):
49
49
"""An order containing a subset of component names works fine."""
50
50
# Arrange
51
51
config = {
52
- "major" : VersionComponentConfig (),
53
- "minor" : VersionComponentConfig (),
54
- "patch" : VersionComponentConfig (),
52
+ "major" : VersionComponentSpec (),
53
+ "minor" : VersionComponentSpec (),
54
+ "patch" : VersionComponentSpec (),
55
55
}
56
56
57
57
# Act
@@ -64,9 +64,9 @@ def test_dependency_map_follows_order(self):
64
64
"""The order of components correctly creates the dependency map."""
65
65
# Arrange
66
66
config = {
67
- "major" : VersionComponentConfig (),
68
- "minor" : VersionComponentConfig (),
69
- "patch" : VersionComponentConfig (),
67
+ "major" : VersionComponentSpec (),
68
+ "minor" : VersionComponentSpec (),
69
+ "patch" : VersionComponentSpec (),
70
70
}
71
71
72
72
# Act
@@ -81,9 +81,9 @@ def test_dependency_map_skips_independent_components(self):
81
81
"""Independent components are not in the dependency map."""
82
82
# Arrange
83
83
config = {
84
- "major" : VersionComponentConfig (),
85
- "minor" : VersionComponentConfig (independent = True ),
86
- "patch" : VersionComponentConfig (),
84
+ "major" : VersionComponentSpec (),
85
+ "minor" : VersionComponentSpec (independent = True ),
86
+ "patch" : VersionComponentSpec (),
87
87
}
88
88
89
89
# Act
@@ -99,10 +99,10 @@ def test_empty_values_creates_default_version(self):
99
99
"""An empty values dict raises an error."""
100
100
# Arrange
101
101
config = {
102
- "major" : VersionComponentConfig (),
103
- "minor" : VersionComponentConfig (),
104
- "patch" : VersionComponentConfig (),
105
- "build" : VersionComponentConfig (independent = True ),
102
+ "major" : VersionComponentSpec (),
103
+ "minor" : VersionComponentSpec (),
104
+ "patch" : VersionComponentSpec (),
105
+ "build" : VersionComponentSpec (independent = True ),
106
106
}
107
107
version_spec = VersionSpec (config )
108
108
@@ -119,10 +119,10 @@ def test_missing_values_uses_component_first_value(self):
119
119
"""A missing value raises an error."""
120
120
# Arrange
121
121
config = {
122
- "major" : VersionComponentConfig (),
123
- "minor" : VersionComponentConfig (),
124
- "patch" : VersionComponentConfig (),
125
- "build" : VersionComponentConfig (independent = True ),
122
+ "major" : VersionComponentSpec (),
123
+ "minor" : VersionComponentSpec (),
124
+ "patch" : VersionComponentSpec (),
125
+ "build" : VersionComponentSpec (independent = True ),
126
126
}
127
127
version_spec = VersionSpec (config )
128
128
@@ -139,9 +139,9 @@ def test_extra_values_ignored(self):
139
139
"""Extra values are ignored."""
140
140
# Arrange
141
141
config = {
142
- "major" : VersionComponentConfig (),
143
- "minor" : VersionComponentConfig (),
144
- "patch" : VersionComponentConfig (),
142
+ "major" : VersionComponentSpec (),
143
+ "minor" : VersionComponentSpec (),
144
+ "patch" : VersionComponentSpec (),
145
145
}
146
146
version_spec = VersionSpec (config )
147
147
@@ -161,9 +161,9 @@ def test_bad_component_name_returns_empty_list(self):
161
161
"""Getting the dependents of a non-existing component returns an empty list."""
162
162
# Arrange
163
163
config = {
164
- "major" : VersionComponentConfig (),
165
- "minor" : VersionComponentConfig (),
166
- "patch" : VersionComponentConfig (),
164
+ "major" : VersionComponentSpec (),
165
+ "minor" : VersionComponentSpec (),
166
+ "patch" : VersionComponentSpec (),
167
167
}
168
168
version_spec = VersionSpec (config )
169
169
@@ -177,9 +177,9 @@ def test_extra_values_ignored(self):
177
177
"""Extra values are ignored."""
178
178
# Arrange
179
179
config = {
180
- "major" : VersionComponentConfig (),
181
- "minor" : VersionComponentConfig (),
182
- "patch" : VersionComponentConfig (),
180
+ "major" : VersionComponentSpec (),
181
+ "minor" : VersionComponentSpec (),
182
+ "patch" : VersionComponentSpec (),
183
183
}
184
184
version_spec = VersionSpec (config )
185
185
0 commit comments