@@ -389,23 +389,61 @@ def test_load_section_yaml(self):
389
389
assert sec_type_undefined_err
390
390
assert sec_type_empty_err
391
391
392
+ def test_load_dtypes_yaml (self ):
393
+ """
394
+ Test if loading yaml document raises validation errors for Properties with undefined dtypes.
395
+ """
396
+
397
+ path = os .path .join (self .dir_path , "resources" , "validation_dtypes.yaml" )
398
+ doc = odml .load (path , "YAML" )
399
+
400
+ self .assertError (validate (doc ), 'Dtype of property "members_no" currently is "string", '
401
+ 'but might fit dtype "int"!' )
402
+
403
+ self .assertError (validate (doc ), 'Dtype of property "potential_no" currently is "string", '
404
+ 'but might fit dtype "float"!' )
405
+
406
+ self .assertError (validate (doc ), 'Dtype of property "dates_no" currently is "string", '
407
+ 'but might fit dtype "date"!' )
408
+
409
+ self .assertError (validate (doc ), 'Dtype of property "datetimes_no" currently is "string", '
410
+ 'but might fit dtype "datetime"!' )
411
+
412
+ self .assertError (validate (doc ), 'Dtype of property "times_no" currently is "string", '
413
+ 'but might fit dtype "time"!' )
414
+
415
+ self .assertError (validate (doc ), 'Dtype of property "sent_no" currently is "string", '
416
+ 'but might fit dtype "boolean"!' )
417
+
418
+ self .assertError (validate (doc ), 'Dtype of property "Location_no" currently is "string", '
419
+ 'but might fit dtype "2-tuple"!' )
420
+
421
+ self .assertError (validate (doc ), 'Dtype of property "Coos_no" currently is "string", '
422
+ 'but might fit dtype "3-tuple"!' )
423
+
424
+ self .assertError (validate (doc ), 'Dtype of property "members_mislabelled" currently is '
425
+ '"string", but might fit dtype "int"!' )
426
+
427
+ self .assertError (validate (doc ), 'Dtype of property "potential_mislabelled" currently is '
428
+ '"string", but might fit dtype "float"!' )
429
+
430
+ self .assertError (validate (doc ), 'Dtype of property "dates_mislabelled" currently is '
431
+ '"string", but might fit dtype "date"!' )
432
+
433
+ self .assertError (validate (doc ), 'Dtype of property "datetimes_mislabelled" currently is '
434
+ '"string", but might fit dtype "datetime"!' )
392
435
436
+ self .assertError (validate (doc ), 'Dtype of property "times_mislabelled" currently is '
437
+ '"string", but might fit dtype "time"!' )
393
438
439
+ self .assertError (validate (doc ), 'Dtype of property "sent_mislabelled" currently is '
440
+ '"string", but might fit dtype "boolean"!' )
394
441
395
- assert sec_test_1_err
396
- assert sec_test_2_err
397
-
398
- self .assertError (validate (doc ), 'Dtype of property "members" currently is "string", but might fit dtype "int"!' )
399
- self .assertError (validate (doc ),
400
- 'Dtype of property "potential" currently is "string", but might fit dtype "float"!' )
401
- self .assertError (validate (doc ), 'Dtype of property "dates" currently is "string", but might fit dtype "date"!' )
402
- self .assertError (validate (doc ),
403
- 'Dtype of property "datetimes" currently is "string", but might fit dtype "datetime"!' )
404
- self .assertError (validate (doc ), 'Dtype of property "times" currently is "string", but might fit dtype "time"!' )
405
- self .assertError (validate (doc ),
406
- 'Dtype of property "sent" currently is "string", but might fit dtype "boolean"!' )
407
- self .assertError (validate (doc ), 'Dtype of property "texts" currently is "string", but might fit dtype "text"!' )
408
- self .assertError (validate (doc ),
409
- 'Dtype of property "Location" currently is "string", but might fit dtype "2-tuple"!' )
410
- self .assertError (validate (doc ),
411
- 'Dtype of property "Coos" currently is "string", but might fit dtype "3-tuple"!' )
442
+ self .assertError (validate (doc ), 'Dtype of property "texts_mislabelled" currently is '
443
+ '"string", but might fit dtype "text"!' )
444
+
445
+ self .assertError (validate (doc ), 'Dtype of property "Location_mislabelled" currently is '
446
+ '"string", but might fit dtype "2-tuple"!' )
447
+
448
+ self .assertError (validate (doc ), 'Dtype of property "Coos_mislabelled" currently is '
449
+ '"string", but might fit dtype "3-tuple"!' )
0 commit comments