2022-10-10 14:20:21 +02:00
|
|
|
import pytest
|
|
|
|
|
import ifcopenshell
|
2024-05-08 17:21:00 +05:00
|
|
|
import ifcopenshell.guid
|
2022-10-10 14:20:21 +02:00
|
|
|
|
2024-07-26 12:00:28 +10:00
|
|
|
|
2022-10-10 14:20:21 +02:00
|
|
|
def test_file_gc():
|
|
|
|
|
f = ifcopenshell.file()
|
|
|
|
|
inst = f.createIfcWall(ifcopenshell.guid.new(), Name=chr(0x1F37A))
|
|
|
|
|
# 0x1F37A should be encoded using X4
|
2024-07-26 12:00:28 +10:00
|
|
|
assert "\\X4\\" in inst.to_string()
|
2022-10-10 14:20:21 +02:00
|
|
|
# to_string() should use upper case entity names
|
2024-07-26 12:00:28 +10:00
|
|
|
assert "IFCWALL" in inst.to_string()
|
2022-10-10 14:20:21 +02:00
|
|
|
# __str__ uses camel case entity names
|
2024-07-26 12:00:28 +10:00
|
|
|
assert "IfcWall" in str(inst)
|
2022-10-10 14:20:21 +02:00
|
|
|
# in fact, __str__ is equal to to_string(False)
|
|
|
|
|
assert str(inst) == inst.to_string(False)
|
|
|
|
|
|
2024-07-26 12:00:28 +10:00
|
|
|
|
2022-10-10 14:20:21 +02:00
|
|
|
if __name__ == "__main__":
|
|
|
|
|
pytest.main(["-sx", __file__])
|