@@ -310,25 +310,67 @@ def test_load_section_json(self):
310
310
assert sec_type_undefined_err
311
311
assert sec_type_empty_err
312
312
313
- self .assertError (validate (doc ), 'Dtype of property "members" currently is "string", but might fit dtype "int"!' )
314
- self .assertError (validate (doc ),
315
- 'Dtype of property "potential" currently is "string", but might fit dtype "float"!' )
316
- self .assertError (validate (doc ), 'Dtype of property "dates" currently is "string", but might fit dtype "date"!' )
317
- self .assertError (validate (doc ),
318
- 'Dtype of property "datetimes" currently is "string", but might fit dtype "datetime"!' )
319
- self .assertError (validate (doc ), 'Dtype of property "times" currently is "string", but might fit dtype "time"!' )
320
- self .assertError (validate (doc ),
321
- 'Dtype of property "sent" currently is "string", but might fit dtype "boolean"!' )
322
- self .assertError (validate (doc ), 'Dtype of property "texts" currently is "string", but might fit dtype "text"!' )
323
- self .assertError (validate (doc ),
324
- 'Dtype of property "Location" currently is "string", but might fit dtype "2-tuple"!' )
325
- self .assertError (validate (doc ),
326
- 'Dtype of property "Coos" currently is "string", but might fit dtype "3-tuple"!' )
313
+ def test_load_dtypes_json (self ):
314
+ """
315
+ Test if loading json document raises validation errors for Properties with undefined dtypes.
316
+ """
317
+
318
+ path = os .path .join (self .dir_path , "resources" , "validation_dtypes.json" )
319
+ doc = odml .load (path , "JSON" )
320
+
321
+ self .assertError (validate (doc ), 'Dtype of property "members_no" currently is "string", '
322
+ 'but might fit dtype "int"!' )
323
+
324
+ self .assertError (validate (doc ), 'Dtype of property "potential_no" currently is "string", '
325
+ 'but might fit dtype "float"!' )
326
+
327
+ self .assertError (validate (doc ), 'Dtype of property "dates_no" currently is "string", '
328
+ 'but might fit dtype "date"!' )
329
+
330
+ self .assertError (validate (doc ), 'Dtype of property "datetimes_no" currently is "string", '
331
+ 'but might fit dtype "datetime"!' )
332
+
333
+ self .assertError (validate (doc ), 'Dtype of property "times_no" currently is "string", '
334
+ 'but might fit dtype "time"!' )
335
+
336
+ self .assertError (validate (doc ), 'Dtype of property "sent_no" currently is "string", '
337
+ 'but might fit dtype "boolean"!' )
338
+
339
+ self .assertError (validate (doc ), 'Dtype of property "Location_no" currently is "string", '
340
+ 'but might fit dtype "2-tuple"!' )
341
+
342
+ self .assertError (validate (doc ), 'Dtype of property "Coos_no" currently is "string", '
343
+ 'but might fit dtype "3-tuple"!' )
344
+
345
+ self .assertError (validate (doc ), 'Dtype of property "members_mislabelled" currently is '
346
+ '"string", but might fit dtype "int"!' )
347
+
348
+ self .assertError (validate (doc ), 'Dtype of property "potential_mislabelled" currently is '
349
+ '"string", but might fit dtype "float"!' )
350
+
351
+ self .assertError (validate (doc ), 'Dtype of property "dates_mislabelled" currently is '
352
+ '"string", but might fit dtype "date"!' )
353
+
354
+ self .assertError (validate (doc ), 'Dtype of property "datetimes_mislabelled" currently is '
355
+ '"string", but might fit dtype "datetime"!' )
356
+
357
+ self .assertError (validate (doc ), 'Dtype of property "times_mislabelled" currently is '
358
+ '"string", but might fit dtype "time"!' )
359
+
360
+ self .assertError (validate (doc ), 'Dtype of property "sent_mislabelled" currently is '
361
+ '"string", but might fit dtype "boolean"!' )
362
+
363
+ self .assertError (validate (doc ), 'Dtype of property "texts_mislabelled" currently is '
364
+ '"string", but might fit dtype "text"!' )
365
+
366
+ self .assertError (validate (doc ), 'Dtype of property "Location_mislabelled" currently is '
367
+ '"string", but might fit dtype "2-tuple"!' )
368
+
369
+ self .assertError (validate (doc ), 'Dtype of property "Coos_mislabelled" currently is '
370
+ '"string", but might fit dtype "3-tuple"!' )
371
+
327
372
328
- def test_load_yaml (self ):
329
373
330
- """
331
- Test if loading yaml document raises validation errors. Errors are:
332
374
333
375
- Undefined Section type
334
376
- Properties with undefined dtypes
0 commit comments