From 2dee2afdfae7da9faedbfeb7c3f3ff935c801602 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Wed, 5 Oct 2022 13:07:16 +0200 Subject: [PATCH] #1861 test case --- .../test/global_id_updates.py | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/ifcopenshell-python/test/global_id_updates.py diff --git a/src/ifcopenshell-python/test/global_id_updates.py b/src/ifcopenshell-python/test/global_id_updates.py new file mode 100644 index 0000000000..314843953e --- /dev/null +++ b/src/ifcopenshell-python/test/global_id_updates.py @@ -0,0 +1,24 @@ +import pytest +import ifcopenshell + +def test_global_id_updates(): + g1, g2, g3 = (ifcopenshell.guid.new() for i in range(3)) + f = ifcopenshell.file() + + f.createIfcWall(g1) + f[g1].GlobalId = g2 + with pytest.raises(RuntimeError): + f[g1] + assert f[g2] + + inst = f.createIfcWall() + inst.GlobalId = g3 + assert f[g3] + + # Non-unique guid, succeeds but logs an error + ifcopenshell.get_log() + inst = f.createIfcWall(g3) + assert "Overwriting" in ifcopenshell.get_log() + +if __name__ == "__main__": + pytest.main(["-sx", __file__])