forked from graphnet-team/graphnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request graphnet-team#605 from RasmusOrsoe/example_unit_tests
Unit tests for Examples
- Loading branch information
Showing
21 changed files
with
145 additions
and
39 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
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
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
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -66,6 +66,6 @@ def main() -> None: | |
""" | ||
) | ||
|
||
args = parser.parse_args() | ||
args, unknown = parser.parse_known_args() | ||
|
||
main() |
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
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 |
---|---|---|
|
@@ -37,6 +37,6 @@ def main() -> None: | |
""" | ||
) | ||
|
||
args = parser.parse_args() | ||
args, unknown = parser.parse_known_args() | ||
|
||
main() |
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 |
---|---|---|
|
@@ -45,6 +45,6 @@ def main() -> None: | |
""" | ||
) | ||
|
||
args = parser.parse_args() | ||
args, unknown = parser.parse_known_args() | ||
|
||
main() |
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
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
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 |
---|---|---|
@@ -0,0 +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") | ||
|
||
examples = glob(EXAMPLE_PATH + "/*.py") | ||
|
||
|
||
@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 |
---|---|---|
@@ -0,0 +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") | ||
|
||
|
||
@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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
"""Test for examples in 03_weights.""" | ||
import runpy | ||
import os | ||
from graphnet.constants import GRAPHNET_ROOT_DIR | ||
from glob import glob | ||
import pytest | ||
|
||
EXAMPLE_PATH = os.path.join(GRAPHNET_ROOT_DIR, "examples/03_weights") | ||
|
||
examples = glob(EXAMPLE_PATH + "/*.py") | ||
|
||
|
||
@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 |
---|---|---|
@@ -0,0 +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") | ||
|
||
|
||
examples = glob(EXAMPLE_PATH + "/*.py") | ||
|
||
|
||
@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), run_name="__main__") |