mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
entity_instance: get_info_2 falls back to get_info for unsupported args #4270
get_info_2 advertises the same signature as get_info but raised a bare AssertionError for anything the C++ fast path does not implement -- including its own default arguments (recursive=False). Use the fast path when recursive=True, return_type=dict and ignore=() hold, and delegate to the pure Python get_info otherwise. As noted in the issue, without recursion there is no meaningful performance gain to lose by delegating. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
committed by
Thomas Krijnen
parent
fa597536e1
commit
58cfab48e6
@@ -64,3 +64,14 @@ class TestGetInfo2(test.bootstrap.IFC4):
|
||||
"Outer": {"CfsFaces": None, "type": "IfcClosedShell"},
|
||||
"type": "IfcFacetedBrep",
|
||||
}
|
||||
|
||||
def test_unsupported_arguments_fall_back_to_get_info(self):
|
||||
# Regression test for #4270: get_info_2 raised a bare AssertionError
|
||||
# when called with its own default arguments (recursive=False) or any
|
||||
# other combination the C++ fast path does not implement. It must
|
||||
# delegate to get_info instead of crashing.
|
||||
brep = self.file.create_entity("IfcFacetedBrep")
|
||||
shell = self.file.create_entity("IfcClosedShell")
|
||||
brep.Outer = shell
|
||||
assert brep.get_info_2() == brep.get_info()
|
||||
assert brep.get_info_2(recursive=True, ignore=("Outer",)) == brep.get_info(recursive=True, ignore=("Outer",))
|
||||
|
||||
Reference in New Issue
Block a user