Skip to content

Commit

Permalink
fix tree search test
Browse files Browse the repository at this point in the history
  • Loading branch information
tiankongdeguiji committed Sep 30, 2024
1 parent 8ff0836 commit 8053882
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tzrec/tools/tdm/gen_tree/tree_search_util_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,26 +51,31 @@ def test_cluster(self) -> None:
root = cluster.train(save_tree=False)
search = TreeSearch(output_file=self.test_dir, root=root, child_num=2)
search.save()
search.save_predict_edge(3)
search.save_predict_edge()
search.save_serving_tree()

node_table = []
edge_table = []
predict_edge_table = []
serving_tree = []
with open(os.path.join(self.test_dir, "node_table.txt")) as f:
for line in f:
node_table.append(line)

with open(os.path.join(self.test_dir, "edge_table.txt")) as f:
for line in f:
edge_table.append(line)

with open(os.path.join(self.test_dir, "predict_edge_table.txt")) as f:
for line in f:
predict_edge_table.append(line)
with open(os.path.join(self.test_dir, "serving_tree")) as f:
for line in f:
serving_tree.append(line)

self.assertEqual(len(node_table), 14)
self.assertEqual(len(edge_table), 19)
self.assertEqual(len(predict_edge_table), 7)
self.assertEqual(len(predict_edge_table), 13)
self.assertEqual(len(serving_tree), 14)


if __name__ == "__main__":
Expand Down

0 comments on commit 8053882

Please sign in to comment.