Model linked INIT record tables
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user