Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ packages = ["src/nwb_benchmarks"]

[project]
name = "nwb_benchmarks"
version="0.4.3"
version="0.4.4"
authors = [
{ name="Cody Baker", email="cody.baker@catalystneuro.com" },
]
Expand Down
2 changes: 1 addition & 1 deletion src/nwb_benchmarks/database/_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ def _preprocess_environments(self, df: pl.LazyFrame) -> pl.LazyFrame:
.filter(pl.col("package_version").is_not_null())
.with_columns(
pl.col("environment_id")
.replace({v: k for k, v in ENVIRONMENT_TIMEPOINTS.items()}, default=None)
.replace_strict({v: k for k, v in ENVIRONMENT_TIMEPOINTS.items()}, default=None)
.alias("environment_timepoint")
)
)
Expand Down
26 changes: 26 additions & 0 deletions tests/test_environment_timepoints.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import pytest

pl = pytest.importorskip("polars")

from nwb_benchmarks.database import BenchmarkDatabase
from nwb_benchmarks.database._processing import (
ENVIRONMENT_TIMEPOINTS,
PACKAGES_OF_INTEREST,
)


def test_environments_are_labeled_with_their_timepoint(tmp_path):
timepoint, environment_id = next(iter(ENVIRONMENT_TIMEPOINTS.items()))
environments = pl.LazyFrame(
{
"environment_id": [environment_id, "unknown-environment"],
**{package: ["1.2.3=py_0", "4.5.6"] for package in PACKAGES_OF_INTEREST},
}
)

database = BenchmarkDatabase(results_directory=tmp_path, db_directory=tmp_path)
labeled = database._preprocess_environments(environments).collect()

timepoints = dict(labeled.select(["environment_id", "environment_timepoint"]).unique().iter_rows())
assert timepoints == {environment_id: timepoint, "unknown-environment": None}
assert set(labeled["package_version"]) == {"1.2.3", "4.5.6"}
Loading