Skip to content
Snippets Groups Projects
Commit 03c6b38a authored by Niklas Selke's avatar Niklas Selke
Browse files

Adapted the imports and file paths to the new folder structure for the tests.

parent 25987a82
Branches
Tags
1 merge request!5Modified the test for the 'value_count' statistic. Now all available sampling...
...@@ -12,7 +12,7 @@ from toarstats.metrics.interface import calculate_statistics ...@@ -12,7 +12,7 @@ from toarstats.metrics.interface import calculate_statistics
from toarstats.metrics.stats_utils import create_reference_series from toarstats.metrics.stats_utils import create_reference_series
data = pd.read_csv( data = pd.read_csv(
"tests/time_series.csv", header=None, names=[None, "values"], "tests/test_metrics/time_series.csv", header=None, names=[None, "values"],
index_col=0, parse_dates=True, infer_datetime_format=True index_col=0, parse_dates=True, infer_datetime_format=True
) )
ref_data = create_reference_series(data.index) ref_data = create_reference_series(data.index)
......
...@@ -23,7 +23,9 @@ import numpy as np ...@@ -23,7 +23,9 @@ import numpy as np
import pandas as pd import pandas as pd
import pytest import pytest
from tests.create_sample_data_and_reference_results import create_sample_data from tests.test_metrics.create_sample_data_and_reference_results import (
create_sample_data
)
from toarstats.metrics.interface import calculate_statistics from toarstats.metrics.interface import calculate_statistics
...@@ -33,7 +35,7 @@ def get_all_statistics(): ...@@ -33,7 +35,7 @@ def get_all_statistics():
:return: A set of all implemented statistics :return: A set of all implemented statistics
""" """
statistics = set() statistics = set()
for file in Path(Path(__file__).resolve().parents[1], for file in Path(Path(__file__).resolve().parents[2],
"toarstats/metrics").glob("*.py"): "toarstats/metrics").glob("*.py"):
for node in ast.parse(file.read_text(), file).body: for node in ast.parse(file.read_text(), file).body:
if (isinstance(node, ast.FunctionDef) if (isinstance(node, ast.FunctionDef)
...@@ -50,7 +52,7 @@ def get_all_samplings(): ...@@ -50,7 +52,7 @@ def get_all_samplings():
:return: A set of all implemented samplings :return: A set of all implemented samplings
""" """
samplings = set() samplings = set()
for file in Path(Path(__file__).resolve().parents[1], for file in Path(Path(__file__).resolve().parents[2],
"toarstats/metrics").glob("*.py"): "toarstats/metrics").glob("*.py"):
for node in ast.parse(file.read_text(), file).body: for node in ast.parse(file.read_text(), file).body:
if (isinstance(node, ast.Assign) if (isinstance(node, ast.Assign)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment