From 985f4b7a7e2360af8b094a8788d33e37e4ebd7c6 Mon Sep 17 00:00:00 2001 From: Will Langdale Date: Wed, 4 Dec 2024 18:00:19 +0000 Subject: [PATCH] Used a standard naming structure in the postgres tests --- test/server/test_postgresql.py | 70 +++++++++++++++++++--------------- 1 file changed, 40 insertions(+), 30 deletions(-) diff --git a/test/server/test_postgresql.py b/test/server/test_postgresql.py index 545c72b7..73433a4e 100644 --- a/test/server/test_postgresql.py +++ b/test/server/test_postgresql.py @@ -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 @@ -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), }, ), ],