@@ -26,28 +26,25 @@ def test_init_list(self):
26
26
version = types .CompilerVersion ([1 , 0 , 0 ])
27
27
self .assertEqual (version .components , (1 , 0 , 0 ))
28
28
29
- with self .assertNotRaises (ValueError ):
30
- types .CompilerVersion ([1 , 0 ])
31
- types .CompilerVersion ([2 , 3 , 4 ])
32
- types .CompilerVersion ([3 , 1 , 4 , 1 , 5 , 9 ])
29
+ types .CompilerVersion ([1 , 0 ])
30
+ types .CompilerVersion ([2 , 3 , 4 ])
31
+ types .CompilerVersion ([3 , 1 , 4 , 1 , 5 , 9 ])
33
32
34
33
def test_init_tuple (self ):
35
34
version = types .CompilerVersion ((1 , 0 , 0 ))
36
35
self .assertEqual (version .components , (1 , 0 , 0 ))
37
36
38
- with self .assertNotRaises (ValueError ):
39
- types .CompilerVersion ((1 , 0 ))
40
- types .CompilerVersion ((2 , 3 , 4 ))
41
- types .CompilerVersion ((3 , 1 , 4 , 1 , 5 , 9 ))
37
+ types .CompilerVersion ((1 , 0 ))
38
+ types .CompilerVersion ((2 , 3 , 4 ))
39
+ types .CompilerVersion ((3 , 1 , 4 , 1 , 5 , 9 ))
42
40
43
41
def test_init_str (self ):
44
42
version = types .CompilerVersion ('1.0.0' )
45
43
self .assertEqual (version .components , (1 , 0 , 0 ))
46
44
47
- with self .assertNotRaises (ValueError ):
48
- types .CompilerVersion ('1.0' )
49
- types .CompilerVersion ('2.3.4' )
50
- types .CompilerVersion ('3.1.4.1.5.9' )
45
+ types .CompilerVersion ('1.0' )
46
+ types .CompilerVersion ('2.3.4' )
47
+ types .CompilerVersion ('3.1.4.1.5.9' )
51
48
52
49
def test_init_invalid_value (self ):
53
50
with self .assertRaises (ValueError ):
@@ -153,9 +150,7 @@ def test_expands_path(self):
153
150
154
151
def test_assert_exists (self ):
155
152
path_type = types .PathType (assert_exists = True )
156
-
157
- with self .assertNotRaises (ArgumentTypeError ):
158
- path_type (__file__ )
153
+ path_type (__file__ )
159
154
160
155
with self .assertRaises (ArgumentTypeError ):
161
156
path_type ('/nonsensisal/path/' )
@@ -171,8 +166,7 @@ def test_assert_executable(self):
171
166
172
167
bash_path = '/bin/bash'
173
168
if os .path .isfile (bash_path ) and os .access (bash_path , os .X_OK ):
174
- with self .assertNotRaises (ArgumentTypeError ):
175
- path_type (bash_path )
169
+ path_type (bash_path )
176
170
177
171
with self .assertRaises (ArgumentTypeError ):
178
172
path_type (__file__ )
@@ -189,10 +183,9 @@ class TestRegexType(TestCase):
189
183
def test_regex_match (self ):
190
184
regex_type = types .RegexType (r'a+b*' )
191
185
192
- with self .assertNotRaises (ArgumentTypeError ):
193
- regex_type ('a' )
194
- regex_type ('aab' )
195
- regex_type ('abbbbbbb' )
186
+ regex_type ('a' )
187
+ regex_type ('aab' )
188
+ regex_type ('abbbbbbb' )
196
189
197
190
def test_raises_argument_error (self ):
198
191
regex_type = types .RegexType (r'a+b*' )
@@ -216,11 +209,10 @@ def test_valid_clang_version(self):
216
209
self .assertIsInstance (version , types .CompilerVersion )
217
210
self .assertEqual (version .components , (1 , 0 , 0 , 1 ))
218
211
219
- with self .assertNotRaises (ArgumentTypeError ):
220
- clang_version_type ('1.0.0' )
221
- clang_version_type ('3.0.2.1' )
222
- clang_version_type ('200.0.56.3' )
223
- clang_version_type ('100000.0.0.1' )
212
+ clang_version_type ('1.0.0' )
213
+ clang_version_type ('3.0.2.1' )
214
+ clang_version_type ('200.0.56.3' )
215
+ clang_version_type ('100000.0.0.1' )
224
216
225
217
def test_invalid_clang_version (self ):
226
218
clang_version_type = types .ClangVersionType ()
@@ -245,11 +237,10 @@ def test_valid_swift_version(self):
245
237
self .assertIsInstance (version , types .CompilerVersion )
246
238
self .assertEqual (version .components , (1 , 0 , 1 ))
247
239
248
- with self .assertNotRaises (ArgumentTypeError ):
249
- swift_version_type ('1.0' )
250
- swift_version_type ('3.0.2' )
251
- swift_version_type ('200.0.56' )
252
- swift_version_type ('100000.0.1' )
240
+ swift_version_type ('1.0' )
241
+ swift_version_type ('3.0.2' )
242
+ swift_version_type ('200.0.56' )
243
+ swift_version_type ('100000.0.1' )
253
244
254
245
def test_invalid_swift_version (self ):
255
246
swift_version_type = types .SwiftVersionType ()
0 commit comments