Skip to content

Commit

Permalink
test: update config in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrugman committed Jun 14, 2022
1 parent 5b36564 commit bdc3768
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
22 changes: 11 additions & 11 deletions tests/popmon/alerting/test_apply_tl_bounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
rolling_mean,
)
from popmon.base import Pipeline
from popmon.config import Settings
from popmon.visualization.section_generator import SectionGenerator


Expand Down Expand Up @@ -225,16 +226,14 @@ def test_rolling_window_funcs():

def test_report_traffic_light_bounds():
datastore = {"to_profile": {"asc_numbers": get_test_data()}}

conf = {
"monitoring_rules": {
"the_feature:mae": [8, 4, 2, 0.15],
"mse": [0.2, 0.11, 0.09, 0],
"mae": [1, 0, 0, 0],
"*_pull": [7, 4, -4, -7],
},
"pull_rules": {"*_pull": [7, 4, -4, -7]},
settings = Settings()
settings.monitoring.monitoring_rules = {
"the_feature:mae": [8, 4, 2, 0.15],
"mse": [0.2, 0.11, 0.09, 0],
"mae": [1, 0, 0, 0],
"*_pull": [7, 4, -4, -7],
}
settings.monitoring.pull_rules = {"*_pull": [7, 4, -4, -7]}

m1 = ApplyFunc(
apply_to_key="to_profile", features=["asc_numbers"], metrics=["a", "b"]
Expand All @@ -250,12 +249,12 @@ def test_report_traffic_light_bounds():
ctlb = ComputeTLBounds(
read_key="to_profile",
store_key="static_tlb",
monitoring_rules=conf["monitoring_rules"],
monitoring_rules=settings.monitoring.monitoring_rules,
)

m3 = ComputeTLBounds(
read_key="to_profile",
monitoring_rules=conf["pull_rules"],
monitoring_rules=settings.monitoring.pull_rules,
apply_funcs_key="dynamic_tlb",
func=pull_bounds,
metrics_wide=True,
Expand All @@ -272,6 +271,7 @@ def test_report_traffic_light_bounds():
section_name="Profiles",
dynamic_bounds="dtlb",
static_bounds="static_tlb",
settings=settings.report,
)

pipeline = Pipeline(modules=[m1, m2, ctlb, m3, m4, rg])
Expand Down
4 changes: 1 addition & 3 deletions tests/popmon/analysis/comparison/test_hist_comparer.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ def test_hist_compare():


def test_reference_hist_comparer():

hist_list = ["date:country", "date:bankrupt", "date:num_employees", "date:A_score"]
features = ["country", "bankrupt", "num_employees", "A_score"]

Expand Down Expand Up @@ -116,7 +115,7 @@ def test_reference_hist_comparer():

df = datastore["comparison"]["A_score"]
assert len(df) == 16
np.testing.assert_array_equal(sorted(df.columns), sorted(cols))
assert set(df.columns) == set(cols)
np.testing.assert_almost_equal(df["ref_chi2"].mean(), 2.623206018518519)

df = datastore["comparison"]["country"]
Expand All @@ -136,7 +135,6 @@ def test_reference_hist_comparer():


def test_expanding_hist_comparer():

hist_list = ["date:country", "date:bankrupt", "date:num_employees", "date:A_score"]
features = ["country", "bankrupt", "num_employees", "A_score"]

Expand Down

0 comments on commit bdc3768

Please sign in to comment.