mirror of
https://github.com/macaodha/batdetect2.git
synced 2025-06-29 14:41:58 +02:00
Fix testing issues
This commit is contained in:
parent
8253b5bdc4
commit
b5b4229990
@ -1,5 +1,5 @@
|
||||
from pathlib import Path
|
||||
from typing import List, Tuple
|
||||
from typing import List, Optional, Tuple
|
||||
|
||||
import numpy as np
|
||||
import pytest
|
||||
@ -25,6 +25,7 @@ def dummy_geometry_builder():
|
||||
def _builder(
|
||||
position: Tuple[float, float],
|
||||
dimensions: xr.DataArray,
|
||||
class_name: Optional[str] = None,
|
||||
) -> data.BoundingBox:
|
||||
time, freq = position
|
||||
width = dimensions.sel(dimension="width").item()
|
||||
@ -106,7 +107,7 @@ def sample_detection_dataset() -> xr.Dataset:
|
||||
scores_data,
|
||||
coords=detection_coords,
|
||||
dims=["detection"],
|
||||
name="score",
|
||||
name="scores",
|
||||
)
|
||||
|
||||
dimensions_data = np.array([[7.0, 16.0], [3.0, 12.0]], dtype=np.float32)
|
||||
@ -140,7 +141,7 @@ def sample_detection_dataset() -> xr.Dataset:
|
||||
|
||||
ds = xr.Dataset(
|
||||
{
|
||||
"score": scores,
|
||||
"scores": scores,
|
||||
"dimensions": dimensions,
|
||||
"classes": classes,
|
||||
"features": features,
|
||||
|
@ -109,6 +109,7 @@ def test_get_tag_from_info_key_not_found():
|
||||
|
||||
|
||||
def test_load_terms_from_config(tmp_path):
|
||||
term_registry = TermRegistry()
|
||||
config_data = {
|
||||
"terms": [
|
||||
{
|
||||
@ -127,7 +128,10 @@ def test_load_terms_from_config(tmp_path):
|
||||
with open(config_file, "w") as f:
|
||||
yaml.dump(config_data, f)
|
||||
|
||||
loaded_terms = load_terms_from_config(config_file)
|
||||
loaded_terms = load_terms_from_config(
|
||||
config_file,
|
||||
term_registry=term_registry,
|
||||
)
|
||||
assert "species" in loaded_terms
|
||||
assert "my_custom_term" in loaded_terms
|
||||
assert loaded_terms["species"].name == "dwc:scientificName"
|
||||
|
Loading…
Reference in New Issue
Block a user