ifcopenshell-python: test_rocks queries the fixed-width hex keys

The test looked up raw keys in the decimal layout ("i|139|5",
"t|<identity>|0"); numeric key segments are fixed-width hex now.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HNrXDmR88wKPCYwGE21SyH
This commit is contained in:
Dion Moult
2026-09-17 15:33:27 +10:00
parent 9334308ffb
commit 39f8f90414
@@ -111,9 +111,11 @@ def test_rocks():
assert f[139].RelatingPropertyDefinition.is_a("IfcPropertySetDefinitionSet") assert f[139].RelatingPropertyDefinition.is_a("IfcPropertySetDefinitionSet")
assert {x.id() for x in f[139].RelatingPropertyDefinition[0]} == {136, 138} assert {x.id() for x in f[139].RelatingPropertyDefinition[0]} == {136, 138}
b = f.key_value_store_query("i|139|5")[2:] # Numeric key segments are fixed-width hex: i|<id>|<attribute>,
# t|<identity>|<attribute>. See rocksdb_map_adapter.h.
b = f.key_value_store_query(f"i|{139:016x}|{5:016x}")[2:]
iden = struct.unpack("Q", b)[0] iden = struct.unpack("Q", b)[0]
b = f.key_value_store_query(f"t|{iden}|0")[1:] b = f.key_value_store_query(f"t|{iden:016x}|{0:016x}")[1:]
assert set(struct.unpack("Q", b[i : i + 8])[0] for i in range(1, len(b), 9)) == {136, 138} assert set(struct.unpack("Q", b[i : i + 8])[0] for i in range(1, len(b), 9)) == {136, 138}
g = ifcopenshell.open(fn) g = ifcopenshell.open(fn)