@@ -231,25 +231,67 @@ def test_load_section_xml(self):
231231 assert sec_type_undefined_err
232232 assert sec_type_empty_err
233233
234- self .assertError (validate (doc ), 'Dtype of property "members" currently is "string", but might fit dtype "int"!' )
235- self .assertError (validate (doc ),
236- 'Dtype of property "potential" currently is "string", but might fit dtype "float"!' )
237- self .assertError (validate (doc ), 'Dtype of property "dates" currently is "string", but might fit dtype "date"!' )
238- self .assertError (validate (doc ),
239- 'Dtype of property "datetimes" currently is "string", but might fit dtype "datetime"!' )
240- self .assertError (validate (doc ), 'Dtype of property "times" currently is "string", but might fit dtype "time"!' )
241- self .assertError (validate (doc ),
242- 'Dtype of property "sent" currently is "string", but might fit dtype "boolean"!' )
243- self .assertError (validate (doc ), 'Dtype of property "texts" currently is "string", but might fit dtype "text"!' )
244- self .assertError (validate (doc ),
245- 'Dtype of property "Location" currently is "string", but might fit dtype "2-tuple"!' )
246- self .assertError (validate (doc ),
247- 'Dtype of property "Coos" currently is "string", but might fit dtype "3-tuple"!' )
234+ def test_load_dtypes_xml (self ):
235+ """
236+ Test if loading xml document raises validation errors for Properties with undefined dtypes.
237+ """
238+
239+ path = os .path .join (self .dir_path , "resources" , "validation_dtypes.xml" )
240+ doc = odml .load (path )
241+
242+ self .assertError (validate (doc ), 'Dtype of property "members_no" currently is "string", '
243+ 'but might fit dtype "int"!' )
244+
245+ self .assertError (validate (doc ), 'Dtype of property "potential_no" currently is "string", '
246+ 'but might fit dtype "float"!' )
247+
248+ self .assertError (validate (doc ), 'Dtype of property "dates_no" currently is "string", '
249+ 'but might fit dtype "date"!' )
250+
251+ self .assertError (validate (doc ), 'Dtype of property "datetimes_no" currently is "string", '
252+ 'but might fit dtype "datetime"!' )
253+
254+ self .assertError (validate (doc ), 'Dtype of property "times_no" currently is "string", '
255+ 'but might fit dtype "time"!' )
256+
257+ self .assertError (validate (doc ), 'Dtype of property "sent_no" currently is "string", '
258+ 'but might fit dtype "boolean"!' )
259+
260+ self .assertError (validate (doc ), 'Dtype of property "Location_no" currently is "string", '
261+ 'but might fit dtype "2-tuple"!' )
262+
263+ self .assertError (validate (doc ), 'Dtype of property "Coos_no" currently is "string", '
264+ 'but might fit dtype "3-tuple"!' )
265+
266+ self .assertError (validate (doc ), 'Dtype of property "members_mislabelled" currently is '
267+ '"string", but might fit dtype "int"!' )
268+
269+ self .assertError (validate (doc ), 'Dtype of property "potential_mislabelled" currently is '
270+ '"string", but might fit dtype "float"!' )
271+
272+ self .assertError (validate (doc ), 'Dtype of property "dates_mislabelled" currently is '
273+ '"string", but might fit dtype "date"!' )
274+
275+ self .assertError (validate (doc ), 'Dtype of property "datetimes_mislabelled" currently is '
276+ '"string", but might fit dtype "datetime"!' )
277+
278+ self .assertError (validate (doc ), 'Dtype of property "times_mislabelled" currently is '
279+ '"string", but might fit dtype "time"!' )
280+
281+ self .assertError (validate (doc ), 'Dtype of property "sent_mislabelled" currently is '
282+ '"string", but might fit dtype "boolean"!' )
283+
284+ self .assertError (validate (doc ), 'Dtype of property "texts_mislabelled" currently is '
285+ '"string", but might fit dtype "text"!' )
286+
287+ self .assertError (validate (doc ), 'Dtype of property "Location_mislabelled" currently is '
288+ '"string", but might fit dtype "2-tuple"!' )
289+
290+ self .assertError (validate (doc ), 'Dtype of property "Coos_mislabelled" currently is '
291+ '"string", but might fit dtype "3-tuple"!' )
292+
248293
249- def test_load_json (self ):
250294
251- """
252- Test if loading json document raises validation errors. Errors are:
253295
254296 - Undefined Section type
255297 - Properties with undefined dtypes
0 commit comments