diff --git a/tests/test_schemas.py b/tests/test_schemas.py index 649a61d..e3e7c49 100644 --- a/tests/test_schemas.py +++ b/tests/test_schemas.py @@ -21,7 +21,7 @@ def __init__(self): self.organisation_schema - v2.03 IATI Organisation schema. """ - self.activity_schema = etree.XMLSchema(etree.parse('iati-activities-schema.xsd')) + self.activity_schema = etree.XMLSchema(etree.parse('iati-activities-schema.xsd')) self.organisation_schema = etree.XMLSchema(etree.parse('iati-organisations-schema.xsd')) @@ -85,15 +85,14 @@ def is_xml(xml_string): def is_iati_xml(xml_string, schema): - parser = etree.XMLParser(schema = schema) + parser = etree.XMLParser(schema=schema) try: - dataset = etree.fromstring(xml_string, parser) + etree.fromstring(xml_string, parser) return True except etree.XMLSyntaxError: return False - @pytest.mark.parametrize('filepath', list_xml_files_recursively('tests/activity-tests/should-pass/') + # Legacy activity test cases list_xml_files_recursively('tests/should-pass/iati-activities/') + # Activity test cases in 2.03+ format list_xml_files_recursively('tests/organisation-tests/should-pass/') + # Legacy organisaion test cases @@ -144,9 +143,9 @@ def test_2_03_fail_files(schema_factory, filepath): assert is_xml(data_str) - parser = etree.XMLParser(schema = schema) + parser = etree.XMLParser(schema=schema) try: - dataset = etree.fromstring(data_str, parser) + etree.fromstring(data_str, parser) except etree.XMLSyntaxError as error_log: expected_error_text = failure_reason_mapping[failure_reason] if re.search(expected_error_text, str(error_log)) is None: