Skip to content

Commit 7ee2ef6

Browse files
committed
[test_validation.py] Add Test for XML File Loading Sections
- Replace part of current XML File Loading Test - Incorporate new file in resources/validation_section.xml
1 parent 4160a8b commit 7ee2ef6

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

test/test_validation.py

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -211,30 +211,25 @@ def test_prop_string_values(self):
211211
self.assertError(validate(prop9), 'Dtype of property "Coos" currently is "string", '
212212
'but might fit dtype "3-tuple"!')
213213

214-
def test_load_xml(self):
215-
214+
def test_load_section_xml(self):
216215
"""
217-
Test if loading xml document raises validation errors. Errors are:
218-
219-
- Undefined Section type
220-
- Properties with undefined dtypes
216+
Test if loading xml document raises validation errors for Sections with undefined type.
221217
"""
222218

223-
dir_path = os.path.dirname(os.path.realpath(__file__))
224-
path = os.path.join(dir_path, "resources", "integration.xml")
219+
path = os.path.join(self.dir_path, "resources", "validation_section.xml")
225220
doc = odml.load(path)
226221

227-
sec_test_1_err = False
228-
sec_test_2_err = False
222+
sec_type_undefined_err = False
223+
sec_type_empty_err = False
229224

230225
for err in validate(doc).errors:
231-
if err.msg == "Section type undefined" and err.obj.name == "sec_test_1":
232-
sec_test_1_err = True
233-
elif err.msg == "Section type undefined" and err.obj.name == "sec_test_2":
234-
sec_test_2_err = True
226+
if err.msg == "Section type undefined" and err.obj.name == "sec_type_undefined":
227+
sec_type_undefined_err = True
228+
elif err.msg == "Section type undefined" and err.obj.name == "sec_type_empty":
229+
sec_type_empty_err = True
235230

236-
assert sec_test_1_err
237-
assert sec_test_2_err
231+
assert sec_type_undefined_err
232+
assert sec_type_empty_err
238233

239234
self.assertError(validate(doc), 'Dtype of property "members" currently is "string", but might fit dtype "int"!')
240235
self.assertError(validate(doc),

0 commit comments

Comments
 (0)