Skip to content

Commit

Permalink
Used a standard naming structure in the postgres tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wpfl-dbt committed Dec 4, 2024
1 parent 49bc48f commit 985f4b7
Showing 1 changed file with 40 additions and 30 deletions.
70 changes: 40 additions & 30 deletions test/server/test_postgresql.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,52 +94,62 @@ def verify_hierarchy(hierarchy: list[tuple[bytes, bytes, float]]) -> None:
# Test case 1: Equal probability components
(
{
"hash": ["AB", "BC", "CD"],
"left_id": ["A", "B", "C"],
"right_id": ["B", "C", "D"],
"hash": ["ab", "bc", "cd"],
"left_id": ["a", "b", "c"],
"right_id": ["b", "c", "d"],
"probability": [1.0, 1.0, 1.0],
},
{
"parent": ["ABCD", "ABCD", "ABCD", "ABCD"],
"child": ["A", "B", "C", "D"],
"parent": ["abcd", "abcd", "abcd", "abcd"],
"child": ["a", "b", "c", "d"],
"threshold": [1.0, 1.0, 1.0, 1.0],
},
{
("AB", "A", 1.0),
("AB", "B", 1.0),
("BC", "B", 1.0),
("BC", "C", 1.0),
("CD", "C", 1.0),
("CD", "D", 1.0),
("ABCD", "AB", 1.0),
("ABCD", "BC", 1.0),
("ABCD", "CD", 1.0),
("ab", "a", 1.0),
("ab", "b", 1.0),
("bc", "b", 1.0),
("bc", "c", 1.0),
("cd", "c", 1.0),
("cd", "d", 1.0),
("abcd", "ab", 1.0),
("abcd", "bc", 1.0),
("abcd", "cd", 1.0),
},
),
# Test case 2: Asymmetric probability components
(
{
"hash": ["a", "j", "k"],
"hash": ["wx", "xy", "yz"],
"left_id": ["w", "x", "y"],
"right_id": ["x", "y", "z"],
"probability": [0.9, 0.85, 0.8],
},
{
"parent": ["a", "a", "b", "b", "b", "c", "c", "c", "c"],
"parent": [
"wx",
"wx",
"wxy",
"wxy",
"wxy",
"wxyz",
"wxyz",
"wxyz",
"wxyz",
],
"child": ["w", "x", "w", "x", "y", "w", "x", "y", "z"],
"threshold": [0.9, 0.9, 0.85, 0.85, 0.85, 0.8, 0.8, 0.8, 0.8],
},
{
("a", "w", 0.9),
("a", "x", 0.9),
("j", "x", 0.85),
("j", "y", 0.85),
("b", "a", 0.85),
("b", "j", 0.85),
("k", "y", 0.8),
("k", "z", 0.8),
("c", "b", 0.8),
("c", "k", 0.8),
("wx", "w", 0.9),
("wx", "x", 0.9),
("xy", "x", 0.85),
("xy", "y", 0.85),
("wxy", "wx", 0.85),
("wxy", "xy", 0.85),
("yz", "y", 0.8),
("yz", "z", 0.8),
("wxyz", "wxy", 0.8),
("wxyz", "yz", 0.8),
},
),
# Test case 3: Empty input
Expand All @@ -160,19 +170,19 @@ def verify_hierarchy(hierarchy: list[tuple[bytes, bytes, float]]) -> None:
# Test case 4: Single two-item component
(
{
"hash": ["a"],
"hash": ["xy"],
"left_id": ["x"],
"right_id": ["y"],
"probability": [0.9],
},
{
"parent": ["a", "a"],
"parent": ["xy", "xy"],
"child": ["x", "y"],
"threshold": [0.9, 0.9],
},
{
("a", "x", 0.9),
("a", "y", 0.9),
("xy", "x", 0.9),
("xy", "y", 0.9),
},
),
],
Expand Down

0 comments on commit 985f4b7

Please sign in to comment.