@@ -252,3 +252,31 @@ def test_load_json(self):
252252 'Dtype of property "Location" currently is "string", but might fit dtype "2-tuple"!' )
253253 self .assertError (validate (doc ),
254254 'Dtype of property "Coos" currently is "string", but might fit dtype "3-tuple"!' )
255+
256+ def test_load_yaml (self ):
257+
258+ """
259+ Test if loading yaml document raises validation errors. Errors are:
260+
261+ - Undefined Section type
262+ - Properties with undefined dtypes
263+ """
264+
265+ doc = odml .load ("./resources/integration.yaml" , "YAML" )
266+
267+ self .assertError (validate (doc ), "Section type undefined" )
268+
269+ self .assertError (validate (doc ), 'Dtype of property "members" currently is "string", but might fit dtype "int"!' )
270+ self .assertError (validate (doc ),
271+ 'Dtype of property "potential" currently is "string", but might fit dtype "float"!' )
272+ self .assertError (validate (doc ), 'Dtype of property "dates" currently is "string", but might fit dtype "date"!' )
273+ self .assertError (validate (doc ),
274+ 'Dtype of property "datetimes" currently is "string", but might fit dtype "datetime"!' )
275+ self .assertError (validate (doc ), 'Dtype of property "times" currently is "string", but might fit dtype "time"!' )
276+ self .assertError (validate (doc ),
277+ 'Dtype of property "sent" currently is "string", but might fit dtype "boolean"!' )
278+ self .assertError (validate (doc ), 'Dtype of property "texts" currently is "string", but might fit dtype "text"!' )
279+ self .assertError (validate (doc ),
280+ 'Dtype of property "Location" currently is "string", but might fit dtype "2-tuple"!' )
281+ self .assertError (validate (doc ),
282+ 'Dtype of property "Coos" currently is "string", but might fit dtype "3-tuple"!' )
0 commit comments