Skip to content

Commit a0dfaf3

Browse files
f_flag testcase
1 parent 607e7e8 commit a0dfaf3

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests/json_front_tests/test_json_class.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import unittest
22
from pathlib import Path
3+
from statistics import StatisticsError
34
import scipy
45
import csv
56
import json
@@ -73,6 +74,30 @@ def test_setup_scenario(self):
7374
def test_setup_causal_specification(self):
7475
self.assertIsInstance(self.json_class.causal_specification, CausalSpecification)
7576

77+
def test_f_flag(self):
78+
example_test = {
79+
"tests": [
80+
{
81+
"name": "test1",
82+
"mutations": {"test_input": "Increase"},
83+
"estimator": "LinearRegressionEstimator",
84+
"estimate_type": "ate",
85+
"effect_modifiers": [],
86+
"expectedEffect": {"test_output": "NoEffect"},
87+
"skip": False,
88+
}
89+
]
90+
}
91+
self.json_class.test_plan = example_test
92+
effects = {"NoEffect": NoEffect()}
93+
mutates = {
94+
"Increase": lambda x: self.json_class.scenario.treatment_variables[x].z3
95+
> self.json_class.scenario.variables[x].z3
96+
}
97+
estimators = {"LinearRegressionEstimator": LinearRegressionEstimator}
98+
with self.assertRaises(StatisticsError):
99+
self.json_class.generate_tests(effects, mutates, estimators, True)
100+
76101
def test_generate_tests_from_json(self):
77102
example_test = {
78103
"tests": [

0 commit comments

Comments
 (0)