9
9
import utils
10
10
11
11
12
- class TestIt (unittest .TestCase ):
12
+ class TestClassifiersSupport (unittest .TestCase ):
13
13
14
- def test_supports_has_support (self ):
14
+ def test_has_support (self ):
15
15
# Arrange
16
16
classifiers = [
17
17
"Programming Language :: Python" ,
@@ -31,7 +31,7 @@ def test_supports_has_support(self):
31
31
# Assert
32
32
self .assertEqual (has_support , "yes" )
33
33
34
- def test_supports_no_support_but_others_are (self ):
34
+ def test_no_support_but_others_are (self ):
35
35
# Arrange
36
36
classifiers = [
37
37
"Programming Language :: Python" ,
@@ -49,7 +49,7 @@ def test_supports_no_support_but_others_are(self):
49
49
# Assert
50
50
self .assertEqual (has_support , "no" )
51
51
52
- def test_supports_no_support_but_other_2x_are (self ):
52
+ def test_no_support_but_other_2x_are (self ):
53
53
# Arrange
54
54
classifiers = [
55
55
"Programming Language :: Python" ,
@@ -63,7 +63,7 @@ def test_supports_no_support_but_other_2x_are(self):
63
63
# Assert
64
64
self .assertEqual (has_support , "no" )
65
65
66
- def test_supports_no_support_but_other_3x_are (self ):
66
+ def test_no_support_but_other_3x_are (self ):
67
67
# Arrange
68
68
classifiers = [
69
69
"Programming Language :: Python" ,
@@ -79,7 +79,7 @@ def test_supports_no_support_but_other_3x_are(self):
79
79
# Assert
80
80
self .assertEqual (has_support , "no" )
81
81
82
- def test_supports_no_support_or_any_major_minor (self ):
82
+ def test_maybe_support_or_any_major_minor (self ):
83
83
# Arrange
84
84
# No major.minor classifiers
85
85
classifiers = [
@@ -88,25 +88,88 @@ def test_supports_no_support_or_any_major_minor(self):
88
88
]
89
89
90
90
# Act
91
- # Classifiers are not explicit: we want to assume support
92
91
has_support = utils .classifiers_support (classifiers , "2.6" )
93
92
94
93
# Assert
95
94
self .assertEqual (has_support , "maybe" )
96
95
97
- def test_supports_no_support_for_empty (self ):
96
+ def test_maybe_support_for_empty (self ):
98
97
# Arrange
99
98
# No classifiers
100
99
classifiers = []
101
100
102
101
# Act
103
- # Classifiers are not explicit: we want to assume support
104
102
has_support = utils .classifiers_support (classifiers , "2.6" )
105
103
106
104
# Assert
107
105
self .assertEqual (has_support , "maybe" )
108
106
109
107
108
+ class TestRequiresPythonSupports (unittest .TestCase ):
109
+
110
+ def test_has_support (self ):
111
+ # Arrange
112
+ python_requires = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*"
113
+
114
+ # Act
115
+ has_support = utils .requires_python_supports (python_requires , "2.6" )
116
+
117
+ # Assert
118
+ self .assertEqual (has_support , "yes" )
119
+
120
+ def test_no_support_but_others_are (self ):
121
+ # Arrange
122
+ python_requires = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
123
+
124
+ # Act
125
+ has_support = utils .requires_python_supports (python_requires , "2.6" )
126
+
127
+ # Assert
128
+ self .assertEqual (has_support , "no" )
129
+
130
+ def test_no_support_but_other_2x_are (self ):
131
+ # Arrange
132
+ python_requires = "==2.7"
133
+
134
+ # Act
135
+ has_support = utils .requires_python_supports (python_requires , "2.6" )
136
+
137
+ # Assert
138
+ self .assertEqual (has_support , "no" )
139
+
140
+ def test_no_support_but_other_3x_are (self ):
141
+ # Arrange
142
+ python_requires = ">=3.4"
143
+
144
+ # Act
145
+ has_support = utils .requires_python_supports (python_requires , "2.6" )
146
+
147
+ # Assert
148
+ self .assertEqual (has_support , "no" )
149
+
150
+ def test_maybe_support_for_none (self ):
151
+ # Arrange
152
+ # No python_requires
153
+ python_requires = None
154
+
155
+ # Act
156
+ has_support = utils .requires_python_supports (python_requires , "2.6" )
157
+
158
+ # Assert
159
+ self .assertEqual (has_support , "maybe" )
160
+
161
+ def test_maybe_support_for_empty (self ):
162
+ # Arrange
163
+ # No python_requires
164
+ python_requires = ""
165
+
166
+ # Act
167
+ has_support = utils .requires_python_supports (python_requires , "2.6" )
168
+
169
+ # Assert
170
+ self .assertEqual (has_support , "maybe" )
171
+
172
+
110
173
if __name__ == '__main__' :
111
174
unittest .main ()
112
175
0 commit comments