diff --git a/src/ifcopenshell-python/test/test_create_shape.py b/src/ifcopenshell-python/test/test_create_shape.py index 57ffa0b78b..46d02c5699 100644 --- a/src/ifcopenshell-python/test/test_create_shape.py +++ b/src/ifcopenshell-python/test/test_create_shape.py @@ -1,3 +1,8 @@ +import functools +import itertools +import multiprocessing +import operator +import os import pytest import test.bootstrap import ifcopenshell @@ -12,6 +17,7 @@ import ifcopenshell.util.shape from ifcopenshell.util.shape_builder import ShapeBuilder from typing import get_args +fn = os.path.join(os.path.dirname(__file__), "fixtures/ColumnPSetsOfSets.ifc") class TestGeomSettings: def test_settings(self): @@ -185,6 +191,28 @@ class TestAssignObject: assert len(set(vs)) == 12 +def test_iterator(): + # just test some permutations of invocation + settings = ifcopenshell.geom.settings() + file_or_filename = [fn, ifcopenshell.open(fn)] + with_or_without_threads = [[], [multiprocessing.cpu_count()]] + includes = [ + {}, + {'include': ['IfcColumn']}, + {'include': [file_or_filename[1].by_type('IfcColumn')[0]]}, + ] + for args in itertools.product(file_or_filename, with_or_without_threads, includes): + kwargs = functools.reduce(operator.or_, (a for a in args if isinstance(a, dict))) + pargs = [] + for a in (_ for _ in args if not isinstance(_, dict)): + if isinstance(a, list): + pargs.extend(a) + else: + pargs.append(a) + iterator = ifcopenshell.geom.iterator(settings, *pargs, **kwargs) + assert iterator.initialize() + + if __name__ == "__main__": import pytest