diff --git a/pyproject.toml b/pyproject.toml index 07ed8bd..bbf13bf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "digiflow" -version = "3.9.1" +version = "3.9.2" description = "Father's Little Digitization Workflow Helper" readme = "README.md" requires-python = ">=3.8" diff --git a/src/digiflow/digiflow_metadata.py b/src/digiflow/digiflow_metadata.py index 3116b64..7150b1b 100644 --- a/src/digiflow/digiflow_metadata.py +++ b/src/digiflow/digiflow_metadata.py @@ -320,7 +320,8 @@ def contains_group(self, group: 'str|List[str]') -> bool: if isinstance(group, list): return any(self.tree.findall(PATTERN_FILEGROUP_USE.format(g), XMLNS) for g in group) - return self.tree.findall(PATTERN_FILEGROUP_USE.format(group), XMLNS) > 0 + _fgroups = self.tree.findall(PATTERN_FILEGROUP_USE.format(group), XMLNS) + return len(_fgroups) > 0 def clear_filegroups(self, black_list=None): """Clear file Groups by blacklist""" diff --git a/tests/test_digiflow_metadata.py b/tests/test_digiflow_metadata.py index 3f3a971..4f0a3e1 100644 --- a/tests/test_digiflow_metadata.py +++ b/tests/test_digiflow_metadata.py @@ -786,3 +786,20 @@ def test_metsreader_kitodo2_mena_periodical_volume_dmd_id(): # assert assert mets_reader.dmd_id == 'DMDLOG_0001' + + +def test_metadata_processor_contains_single_fgroup(): + """Ensure behavior for passing single str arg + Bugfix: + TypeError: '>' not supported between instances of 'list' and 'int' + """ + + _proc = MetsProcessor(TEST_RES / 'k2_mets_morbio_1748529021.xml') + assert _proc.contains_group('MAX') + + +def test_metadata_processor_contains_multiple_fgroup(): + """Ensure behavior for passing list args""" + + _proc = MetsProcessor(TEST_RES / 'k2_mets_morbio_1748529021.xml') + assert _proc.contains_group(['MAX'])