Skip to content

Commit

Permalink
fix is valid nodes test
Browse files Browse the repository at this point in the history
  • Loading branch information
fcollman committed Oct 10, 2023
1 parent 8f0dffd commit 3c81a4b
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions tests/test_chunkedgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from .conftest import test_info, TEST_LOCAL_SERVER, TEST_DATASTACK
import pytest
import responses
from responses.matchers import json_params_matcher
import pytz
import numpy as np
from caveclient.endpoints import (
Expand Down Expand Up @@ -381,7 +382,7 @@ def test_get_remeshing(self, myclient):
responses.POST,
status=200,
url=url,
match=[responses.json_params_matcher({"new_lvl2_ids": chunkid_list})],
match=[json_params_matcher({"new_lvl2_ids": chunkid_list})],
)

myclient.chunkedgraph.remesh_level2_chunks(chunk_ids)
Expand All @@ -403,7 +404,7 @@ def test_is_latest_roots(self, myclient):
status=200,
url=url,
json={"is_latest": is_latest_list},
match=[responses.json_params_matcher({"node_ids": root_id_list})],
match=[json_params_matcher({"node_ids": root_id_list})],
)

qis_latest = myclient.chunkedgraph.is_latest_roots(root_ids)
Expand Down Expand Up @@ -445,7 +446,7 @@ def test_past_ids(self, myclient):
status=200,
url=qurl,
json=id_map_str,
match=[responses.json_params_matcher({"root_ids": root_id_list})],
match=[json_params_matcher({"root_ids": root_id_list})],
)

qid_map = myclient.chunkedgraph.get_past_ids(
Expand Down Expand Up @@ -620,7 +621,7 @@ def test_preview_split(self, myclient):
url=url,
body=json.dumps(response_data),
match=[
responses.json_params_matcher(
json_params_matcher(
{"sources": qdata_svid["sources"], "sinks": qdata_svid["sinks"]}
)
],
Expand Down Expand Up @@ -800,10 +801,32 @@ def test_get_info(self, myclient):

@responses.activate
def test_is_valid_nodes(self, myclient):

endpoint_mapping = self._default_endpoint_map
url = chunkedgraph_endpoints_v1["valid_nodes"].format_map(endpoint_mapping)
query_nodes = [91070075234304972, 91070075234296549]
data = {"node_ids": query_nodes}
return_data = {"valid_roots": query_nodes}
responses.add(
responses.GET,
status=200,
url=url,
json=return_data,
match=[json_params_matcher(data)],
)

out = myclient.chunkedgraph.is_valid_nodes(query_nodes)
assert np.all(out)

query_nodes = [0, -1]
data = {"node_ids": [0, 18446744073709551615]}
return_data = {"valid_roots": []}
responses.add(
responses.GET,
status=200,
url=url,
json=return_data,
match=[json_params_matcher(data)],
)
out = myclient.chunkedgraph.is_valid_nodes(query_nodes)
assert not np.any(out)

0 comments on commit 3c81a4b

Please sign in to comment.