Skip to content

Commit 6b3d6ad

Browse files
add json test class
1 parent 9e48fe0 commit 6b3d6ad

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import unittest
2+
from pathlib import Path
3+
import os
4+
from tests.test_helpers import create_temp_dir_if_non_existent, remove_temp_dir_if_existent
5+
from causal_testing.json_front.json_class import JsonUtility
6+
7+
8+
class TestJsonClass(unittest.TestCase):
9+
""" Test the CausalTestEngine workflow using observational data.
10+
11+
The causal test engine (CTE) is the main workflow for the causal testing framework. The CTE takes a causal test case
12+
and a causal specification and computes the causal effect of the intervention on the outcome of interest.
13+
"""
14+
15+
def setUp(self) -> None:
16+
temp_dir_path = create_temp_dir_if_non_existent()
17+
json_file_name = "tests.json"
18+
dag_file_name = "dag.dot"
19+
data_file_name = "data.csv"
20+
self.json_path = os.path.join(temp_dir_path, json_file_name)
21+
self.dag_path = os.path.join(temp_dir_path, json_file_name)
22+
self.data_path = os.path.join(temp_dir_path, json_file_name)
23+
self.json_class = JsonUtility("logs.log")
24+
self.input_dict_list = [{"name": "test_input", "type": float, "distribution": "uniform"}]
25+
self.output_dict_list = [{"name": "test_output", "type": float}]
26+
self.meta_dict_list = [{"name": "test_meta", "type": float, "populate": "populate_num_lines_unit"}]
27+
28+
def test_set_paths(self):
29+
self.json_class.set_path(self.json_path, self.dag_path, self.data_path)
30+
self.assertEqual(self.json_class.json_path, Path(self.json_path))
31+
self.assertEqual(self.json_class.dag_path, Path(self.dag_path))
32+
self.assertEqual(self.json_class.data_path, Path(self.data_path))
33+
34+
def test_set_inputs:
35+
36+
37+
38+
def tearDown(self) -> None:
39+
remove_temp_dir_if_existent()

0 commit comments

Comments
 (0)