Skip to content
This repository was archived by the owner on Mar 30, 2023. It is now read-only.

Commit d7c107f

Browse files
author
Jason Costello
authored
Merge pull request #8 from hypervectorio/definition-history
Ensemble attribute testing
2 parents d44df6a + 8362ea1 commit d7c107f

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/test_definition_api_resource.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,29 @@ def test_definition_new(mocked_resources):
3737
assert isinstance(definition, hypervector.Definition)
3838

3939

40+
def test_definition_ensembles(mocked_resources, mocked_responses):
41+
_, definition, ensemble, _ = mocked_resources
42+
43+
definition_response = definition.to_response()
44+
definition_response['ensembles'] = [
45+
ensemble.to_response(),
46+
ensemble.to_response(),
47+
ensemble.to_response()
48+
]
49+
50+
mocked_responses.replace(
51+
responses.GET,
52+
f'{hypervector.API_BASE}/definition/{definition.definition_uuid}',
53+
json=definition_response
54+
)
55+
56+
definition = hypervector.Definition.get(definition.definition_uuid)
57+
58+
for ensemble_from_response in definition.ensembles:
59+
assert isinstance(ensemble_from_response, hypervector.Ensemble)
60+
assert len(ensemble_from_response.hypervectors()) == ensemble.size
61+
62+
4063
def test_definition_history(mocked_resources, mocked_responses):
4164
_, definition, _, _ = mocked_resources
4265

0 commit comments

Comments
 (0)