From 86d1154638ac5bb2f30d4ed1ecb7875fb2d9d8eb Mon Sep 17 00:00:00 2001 From: "Gerber, Mike" Date: Fri, 1 Apr 2022 16:05:07 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=94=EF=B8=8F=20Add=20METS=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qurator/modstool/tests/test_mets.py | 35 +++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 qurator/modstool/tests/test_mets.py 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