Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 22 additions & 25 deletions examples/data_hyper_cleaning/test_data_hyper_cleaning.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
import pytest
import subprocess
from unittest.mock import patch
import sys
from pathlib import Path

import pytest

DATA_HYPER_CLEANING_SCRIPT = Path(__file__).with_name("data_hyper_cleaning.py")


def run_data_hyper_cleaning(*args):
command = [sys.executable, str(DATA_HYPER_CLEANING_SCRIPT), *args]
return subprocess.run(command, capture_output=True, text=True)

gm_oplist = (
["NGD"],
Expand Down Expand Up @@ -37,20 +46,17 @@
],
)
def test_combination_dynamic_na_op(gm_op, na_op):
command = [
"python",
"/home/runner/work/BOAT/BOAT/examples/data_hyper_cleaning/data_hyper_cleaning.py",
print(
f"Running test with gm_op={gm_op} and na_op={na_op}"
)

result = run_data_hyper_cleaning(
"--gm_op",
",".join(gm_op),
"--na_op",
",".join(na_op),
]
print(
f"Running test with gm_op={gm_op} and na_op={na_op}"
)

result = subprocess.run(command, capture_output=True, text=True)

assert (
result.returncode == 0
), f"Test failed for gm_op={gm_op} and na_op={na_op}. Error: {result.stderr}"
Expand All @@ -65,36 +71,27 @@ def test_combination_dynamic_na_op(gm_op, na_op):
],
)
def test_combination_dynamic_na_op_dm(gm_op, na_op):
command = [
"python",
"/home/runner/work/BOAT/BOAT/examples/data_hyper_cleaning/data_hyper_cleaning.py",
print(
f"Running test with gm_op={gm_op} and na_op={na_op}"
)

result = run_data_hyper_cleaning(
"--gm_op",
",".join(gm_op),
"--na_op",
",".join(na_op),
]
print(
f"Running test with gm_op={gm_op} and na_op={na_op}"
)

result = subprocess.run(command, capture_output=True, text=True)

assert (
result.returncode == 0
), f"Test failed for gm_op={gm_op} and na_op={na_op}. Error: {result.stderr}"


@pytest.mark.parametrize("fo_ol_method", fo_ol_method)
def test_fo_ol_method(fo_ol_method):
command = [
"python",
"/home/runner/work/BOAT/BOAT/examples/data_hyper_cleaning/data_hyper_cleaning.py",
"--fo_op",
fo_ol_method[0],
]
print(f"Running test with fo_op={fo_ol_method}")

result = subprocess.run(command, capture_output=True, text=True)
result = run_data_hyper_cleaning("--fo_op", fo_ol_method[0])

assert (
result.returncode == 0
Expand Down