added additional tests
All checks were successful
Build on RHEL9 / buildh (push) Successful in 1m52s

This commit is contained in:
Mazzoleni Alice Francesca
2025-04-10 10:41:58 +02:00
parent 76f050f69f
commit 53a90e197e
8 changed files with 29 additions and 539 deletions

View File

@ -25,5 +25,10 @@ def pytest_collection_modifyitems(config, items):
@pytest.fixture
def test_data_path():
return Path(os.environ["AARE_TEST_DATA"])
env_value = os.environ.get("AARE_TEST_DATA")
if not env_value:
raise RuntimeError("Environment variable AARE_TEST_DATA is not set or is empty")
return Path(env_value)

View File

@ -1,7 +1,9 @@
import pytest
import numpy as np
import aare._aare as aare #import ClusterVector_Cluster3x3i, ClusterVector_Cluster2x2i, Interpolator, Cluster3x3i, ClusterFinder_Cluster3x3i, Cluster2x2i, ClusterFile_Cluster3x3i, Cluster3x3f, calculate_eta2
import aare._aare as aare
from conftest import test_data_path
def test_ClusterVector():
"""Test ClusterVector"""
@ -64,15 +66,19 @@ def test_Interpolator():
assert interpolated_photons[0]["energy"] == 4
@pytest.mark.files
def test_cluster_file():
def test_cluster_file(test_data_path):
"""Test ClusterFile"""
cluster_file = aare.ClusterFile_Cluster3x3i(test_data_path() / "clust/single_frame_97_clustrers.clust")
clustervector = cluster_file.read_clusters() #conversion does not work
cluster_file = aare.ClusterFile_Cluster3x3i(test_data_path / "clust/single_frame_97_clustrers.clust")
clustervector = cluster_file.read_clusters(10) #conversion does not work
cluster_file.close()
assert clustervector.size == 10
###reading with wrong file
cluster_file = ClusterFile_Cluster2x2i(test_data_path() / "clust/single_frame_97_clustrers.clust") #TODO check behavior!
with pytest.raises(TypeError):
cluster_file = aare.ClusterFile_Cluster2x2i(test_data_path / "clust/single_frame_97_clustrers.clust")
cluster_file.close()
def test_calculate_eta():
"""Calculate Eta"""
@ -103,6 +109,7 @@ def test_cluster_finder():
assert clusters.size == 0
#TODO dont understand behavior
def test_cluster_collector():
"""Test ClusterCollector"""