-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1ca3e87
commit 2b22ce7
Showing
4 changed files
with
31 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,17 @@ | ||
"""Test for examples in 01_icetray.""" | ||
import runpy | ||
import os | ||
import pytest | ||
from glob import glob | ||
|
||
from graphnet.constants import GRAPHNET_ROOT_DIR | ||
|
||
EXAMPLE_PATH = os.path.join(GRAPHNET_ROOT_DIR, "examples/01_icetray") | ||
|
||
|
||
def test_01_convert_i3_files() -> None: | ||
"""Test for 01_convert_i3_files.""" | ||
runpy.run_path( | ||
os.path.join(EXAMPLE_PATH, "01_convert_i3_files.py"), | ||
run_name="__main__", | ||
) | ||
|
||
|
||
def test_02_compare_sqlite_and_parquet() -> None: | ||
"""Test for 02_compare_sqlite_and_parquet.""" | ||
runpy.run_path( | ||
os.path.join(EXAMPLE_PATH, "02_compare_sqlite_and_parquet.py"), | ||
run_name="__main__", | ||
) | ||
|
||
|
||
def test_03_i3_deployer_example() -> None: | ||
"""Test for 03_i3_deployer_example.""" | ||
runpy.run_path( | ||
os.path.join(EXAMPLE_PATH, "03_i3_deployer_example.py"), | ||
run_name="__main__", | ||
) | ||
|
||
|
||
def test_04_i3_module_in_native_icetray_example() -> None: | ||
"""Test for 04_i3_module_in_native_icetray_example.""" | ||
runpy.run_path( | ||
os.path.join( | ||
EXAMPLE_PATH, "04_i3_module_in_native_icetray_example.py" | ||
), | ||
run_name="__main__", | ||
) | ||
examples = glob(EXAMPLE_PATH + "/*.py") | ||
|
||
|
||
if __name__ == "__main__": | ||
test_01_convert_i3_files() | ||
test_02_compare_sqlite_and_parquet() | ||
test_03_i3_deployer_example() | ||
test_04_i3_module_in_native_icetray_example() | ||
@pytest.mark.parametrize("example", examples) | ||
def test_script_execution(example: str) -> None: | ||
"""Test function that executes example.""" | ||
runpy.run_path(os.path.join(EXAMPLE_PATH, example)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,16 @@ | ||
"""Tests for examples in 02_data.""" | ||
import runpy | ||
import os | ||
import pytest | ||
from glob import glob | ||
|
||
from graphnet.constants import GRAPHNET_ROOT_DIR | ||
|
||
EXAMPLE_PATH = os.path.join(GRAPHNET_ROOT_DIR, "examples/02_data") | ||
examples = glob(EXAMPLE_PATH + "/*.py") | ||
|
||
|
||
def test_01_read_dataset() -> None: | ||
"""Test for 01_read_dataset.""" | ||
runpy.run_path( | ||
os.path.join(EXAMPLE_PATH, "01_read_dataset.py"), run_name="__main__" | ||
) | ||
|
||
|
||
def test_02_plot_feature_distribution() -> None: | ||
"""Test for 02_plot_feature_distribution.""" | ||
runpy.run_path( | ||
os.path.join(EXAMPLE_PATH, "02_plot_feature_distributions.py"), | ||
run_name="__main__", | ||
) | ||
|
||
|
||
def test_03_convert_parquet_to_sqlite() -> None: | ||
"""Test for 03_convert_parquet_to_sqlite.""" | ||
runpy.run_path( | ||
os.path.join(EXAMPLE_PATH, "03_convert_parquet_to_sqlite.py"), | ||
run_name="__main__", | ||
) | ||
|
||
|
||
def test_04_ensemble_dataset() -> None: | ||
"""Test for 04_ensemble_dataset.""" | ||
runpy.run_path( | ||
os.path.join(EXAMPLE_PATH, "04_ensemble_dataset.py"), | ||
run_name="__main__", | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
test_01_read_dataset() | ||
test_02_plot_feature_distribution() | ||
test_03_convert_parquet_to_sqlite() | ||
test_04_ensemble_dataset() | ||
@pytest.mark.parametrize("example", examples) | ||
def test_script_execution(example: str) -> None: | ||
"""Test function that executes example.""" | ||
runpy.run_path(os.path.join(EXAMPLE_PATH, example)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,18 @@ | ||
"""Test for examples in 04_training.""" | ||
import runpy | ||
import os | ||
from glob import glob | ||
import pytest | ||
|
||
from graphnet.constants import GRAPHNET_ROOT_DIR | ||
|
||
EXAMPLE_PATH = os.path.join(GRAPHNET_ROOT_DIR, "examples/04_training") | ||
|
||
|
||
def test_01_train_dynedge() -> None: | ||
"""Test for 01_train_dynedge.""" | ||
runpy.run_path( | ||
os.path.join(EXAMPLE_PATH, "01_train_dynedge.py"), run_name="__main__" | ||
) | ||
|
||
|
||
def test_02_train_tito_model() -> None: | ||
"""Test for 02_train_tito_model.""" | ||
runpy.run_path( | ||
os.path.join(EXAMPLE_PATH, "02_train_tito_model.py"), | ||
run_name="__main__", | ||
) | ||
|
||
|
||
def test_03_train_dynedge_from_config() -> None: | ||
"""Test for 03_train_dynedge_from_config.""" | ||
runpy.run_path( | ||
os.path.join(EXAMPLE_PATH, "03_train_dynedge_from_config.py"), | ||
run_name="__main__", | ||
) | ||
|
||
|
||
def test_04_train_multiclassifier_from_configs() -> None: | ||
"""Test for 04_train_multiclassifier_from_configs.""" | ||
runpy.run_path( | ||
os.path.join(EXAMPLE_PATH, "04_train_multiclassifier_from_configs.py"), | ||
run_name="__main__", | ||
) | ||
examples = glob(EXAMPLE_PATH + "/*.py") | ||
|
||
|
||
if __name__ == "__main__": | ||
test_01_train_dynedge() | ||
test_02_train_tito_model() | ||
test_03_train_dynedge_from_config() | ||
test_04_train_multiclassifier_from_configs() | ||
@pytest.mark.parametrize("example", examples) | ||
def test_script_execution(example: str) -> None: | ||
"""Test function that executes example.""" | ||
runpy.run_path(os.path.join(EXAMPLE_PATH, example)) |