Skip to content

Commit

Permalink
Fix tests for numpy>=2
Browse files Browse the repository at this point in the history
  • Loading branch information
Joni Herttuainen committed Jul 8, 2024
1 parent d7ca855 commit be1b67c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions bluepysnap/circuit_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
L = logging.getLogger("brainbuilder")
MAX_MISSING_FILES_DISPLAY = 10

# print numpy scalars as "1" instead of "np.uint64(1)"
np.set_printoptions(legacy="1.25")


def _check_partial_circuit_config(config):
return config.get("metadata", {}).get("status") == "partial"
Expand Down
6 changes: 3 additions & 3 deletions tests/test_edges.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,9 @@ def test_get(self):
tested = self.test_obj.get(ids, properties=["other2", "other1", "@source_node"])
expected = pd.DataFrame(
{
"other2": np.array([np.NaN, np.NaN, np.NaN, np.NaN, 10, 11, 12, 13], dtype=float),
"other2": np.array([np.nan, np.nan, np.nan, np.nan, 10, 11, 12, 13], dtype=float),
"other1": np.array(
[np.NaN, np.NaN, np.NaN, np.NaN, "A", "B", "C", "D"], dtype=object
[np.nan, np.nan, np.nan, np.nan, "A", "B", "C", "D"], dtype=object
),
"@source_node": np.array([2, 0, 0, 2, 2, 0, 0, 2], dtype=int),
},
Expand Down Expand Up @@ -329,7 +329,7 @@ def test_get(self):
tested = self.test_obj.get(ids, properties="other2")
expected = pd.DataFrame(
{
"other2": np.array([np.NaN, np.NaN, np.NaN, np.NaN, 10, 11, 12, 13], dtype=float),
"other2": np.array([np.nan, np.nan, np.nan, np.nan, 10, 11, 12, 13], dtype=float),
},
index=pd.MultiIndex.from_tuples(
[
Expand Down
6 changes: 3 additions & 3 deletions tests/test_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,8 @@ def test_get(self):
tested = pd.concat(df for _, df in tested)
expected = pd.DataFrame(
{
"other2": np.array([np.NaN, np.NaN, np.NaN, 10, 11, 12, 13], dtype=float),
"other1": np.array([np.NaN, np.NaN, np.NaN, "A", "B", "C", "D"], dtype=object),
"other2": np.array([np.nan, np.nan, np.nan, 10, 11, 12, 13], dtype=float),
"other1": np.array([np.nan, np.nan, np.nan, "A", "B", "C", "D"], dtype=object),
"layer": np.array([2, 6, 6, 7, 8, 8, 2], dtype=int),
},
index=pd.MultiIndex.from_tuples(
Expand Down Expand Up @@ -373,7 +373,7 @@ def test_get(self):
tested = self.test_obj.get(properties="other2")
expected = pd.DataFrame(
{
"other2": np.array([np.NaN, np.NaN, np.NaN, 10, 11, 12, 13], dtype=float),
"other2": np.array([np.nan, np.nan, np.nan, 10, 11, 12, 13], dtype=float),
},
index=pd.MultiIndex.from_tuples(
[
Expand Down

0 comments on commit be1b67c

Please sign in to comment.