Model linked INIT record tables

This commit is contained in:
gamer147
2026-07-22 16:57:59 -04:00
parent d6a69ba9b4
commit 5f743275bf
10 changed files with 268 additions and 11020 deletions

View File

@@ -12,12 +12,14 @@ import init_table_profile as profile
def main() -> int:
fixture = {
"records": [
{"id": 1, "name": "one", "fields": {"0x10": 2, "0x20": 0}},
{"id": 1, "name": "one", "fields": {"0x10": 2, "0x20": 0},
"record_fields": {"0x30/3/0": 9}},
{"id": 3, "name": "three", "fields": {"0x10": 2}},
{"id": 7, "name": "seven", "fields": {"0x10": 5}},
{"id": 7, "name": "seven", "fields": {"0x10": 5},
"record_fields": {"0x30/3/2": 4}},
]
}
rows = {row["base"]: row for row in profile.profile_columns(fixture)}
rows = {row["key"]: row for row in profile.profile_columns(fixture)}
assert rows["0x10"]["population"] == 3
assert rows["0x10"]["coverage"] == 1.0
assert rows["0x10"]["distinct_values"] == 2
@@ -25,6 +27,10 @@ def main() -> int:
assert rows["0x10"]["common"][0] == {"value": "2", "count": 2}
assert rows["0x20"]["population"] == 1
assert rows["0x20"]["examples"][0]["name"] == "one"
assert rows["0x30/3/0"]["kind"] == "record-column"
assert rows["0x30/3/0"]["base"] == "0x30"
assert rows["0x30/3/0"]["stride"] == 3
assert rows["0x30/3/2"]["column"] == 2
print("all init_table_profile checks passed")
return 0