diff --git a/qurator/modstool/tests/test_mets.py b/qurator/modstool/tests/test_mets.py new file mode 100644 index 0000000..6ca22fc --- /dev/null +++ b/qurator/modstool/tests/test_mets.py @@ -0,0 +1,35 @@ +import pytest +import xml.etree.ElementTree as ET + + +from .. import mets_to_dict, flatten + + +def dict_fromstring(x): + """Helper function to parse a METS/MODS XML string to a flattened dict""" + return flatten(mets_to_dict(ET.fromstring(x))) + # XXX move to test lib + +def test_fileGrp(): + """ + Elements of mets:fileGrp should be counted + """ + d = dict_fromstring(""" + + + + + + + + + + + + + + + + + """) + assert d['fileSec_fileGrp-PRESENTATION-count'] == 3