@@ -84,12 +84,6 @@ def test_property_values_cardinality(self):
84
84
self .assertFalse (err .is_error )
85
85
self .assertIn (test_msg , err .msg )
86
86
87
- def test_section_type (self ):
88
- doc = samplefile .parse ("""s1[undefined]""" )
89
- res = validate (doc )
90
- # the section type is undefined (also in the mapping)
91
- self .assertError (res , "Section type undefined" )
92
-
93
87
def test_section_in_terminology (self ):
94
88
doc = samplefile .parse ("""s1[T1]""" )
95
89
res = validate (doc )
@@ -202,17 +196,12 @@ def test_property_name_readable(self):
202
196
def test_standalone_section (self ):
203
197
"""
204
198
Test if standalone section does not return errors if required attributes are correct.
205
- If type is undefined , check error message.
199
+ If type is not specified , check error message.
206
200
"""
207
201
208
202
sec_one = odml .Section ("sec1" )
209
-
210
203
res = validate (sec_one )
211
- self .assertError (res , "Section type undefined" )
212
-
213
- doc = samplefile .parse ("""s1[undefined]""" )
214
- res = validate (doc )
215
- self .assertError (res , "Section type undefined" )
204
+ self .assertError (res , "Section type not specified" )
216
205
217
206
def test_standalone_property (self ):
218
207
"""
@@ -229,14 +218,15 @@ def test_section_init(self):
229
218
"""
230
219
Test validation errors printed to stdout on section init.
231
220
"""
232
- val_errs = StringIO ()
221
+ check_msg = "Missing required attribute 'type'"
233
222
223
+ val_errs = StringIO ()
234
224
old_stdout = sys .stdout
235
225
sys .stdout = val_errs
236
226
odml .Section (name = "sec" , type = None )
237
227
sys .stdout = old_stdout
238
228
239
- self .assertIn ("Section type undefined" , val_errs .getvalue ())
229
+ self .assertIn (check_msg , val_errs .getvalue ())
240
230
241
231
def test_prop_string_values (self ):
242
232
"""
@@ -246,7 +236,7 @@ def test_prop_string_values(self):
246
236
247
237
prop0 = odml .Property (name = 'words' , dtype = "string" ,
248
238
values = ['-13' , '101' , '-11' , 'hello' ])
249
- assert len (validate (prop0 ).errors ) == 0
239
+ self . assertEquals ( len (validate (prop0 ).errors ), 0 )
250
240
251
241
msg_base = 'Dtype of property "%s" currently is "string", but might fit dtype "%s"!'
252
242
0 commit comments