@@ -306,3 +306,32 @@ def test_pid() -> None:
306306 # Check that every value in syn_data['c1'] begins with either 'a' or 'b'
307307 for value in syn_data ["c1" ]:
308308 assert value .startswith ("a" ) or value .startswith ("b" ), f"Value '{ value } ' does not start with 'a' or 'b'"
309+
310+
311+ def test_tree_builder () -> None :
312+ # Create a dataframe with three columns
313+ np .random .seed (42 ) # For reproducible tests
314+ df = pd .DataFrame (
315+ {
316+ "col1" : np .random .choice (["A" , "B" , "C" ], size = 100 ),
317+ "col2" : np .random .randint (0 , 10 , size = 100 ),
318+ "col3" : np .random .uniform (0 , 1 , size = 100 ),
319+ }
320+ )
321+
322+ # Create synthesizer (this should build all trees)
323+ syn = Synthesizer (df )
324+
325+ # Import necessary types for combinations
326+ from itertools import combinations
327+
328+ from syndiffix .common import ColumnId
329+
330+ # Test all possible combinations of columns (1, 2, and 3 columns)
331+ column_indices = [ColumnId (0 ), ColumnId (1 ), ColumnId (2 )] # Indices for col1, col2, col3
332+
333+ for r in range (1 , 4 ): # 1, 2, and 3 columns
334+ for combination in combinations (column_indices , r ):
335+ # Convert to tuple as expected by the tree cache
336+ tree = syn .forest ._tree_cache .get (combination )
337+ assert tree is not None , f"Tree not found for combination { combination } "
0 commit comments