Skip to content

Commit 6f0101e

Browse files
committed
fix: update tests & cleanup console output
1 parent 589ce59 commit 6f0101e

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

trapdata/api/schemas.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,20 +82,23 @@ class ClassificationResponse(pydantic.BaseModel):
8282
"classification in the response. Use the category map from the algorithm "
8383
"to get the full list of labels and metadata."
8484
),
85+
repr=False, # Too long to display in the repr
8586
)
8687
scores: list[float] = pydantic.Field(
8788
default_factory=list,
8889
description=(
8990
"The calibrated probabilities for each class label, most commonly "
9091
"the softmax output."
9192
),
93+
repr=False, # Too long to display in the repr
9294
)
9395
logits: list[float] = pydantic.Field(
9496
default_factory=list,
9597
description=(
9698
"The raw logits output by the model, before any calibration or "
9799
"normalization."
98100
),
101+
repr=False, # Too long to display in the repr
99102
)
100103
inference_time: float | None = None
101104
algorithm: AlgorithmReference

trapdata/api/tests/test_api.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,19 @@ def _send_request(max_predictions_per_classification: int | None):
127127
_send_request(max_predictions_per_classification=None)
128128

129129
def test_pipeline_config_with_binary_classifier(self):
130-
BinaryClassifier = CLASSIFIER_CHOICES["moth_binary"]
130+
binary_classifier_pipeline_choice = "moth_binary"
131+
BinaryClassifier = CLASSIFIER_CHOICES[binary_classifier_pipeline_choice]
131132
BinaryClassifierResponse = make_algorithm_response(BinaryClassifier)
132133

133-
SpeciesClassifier = CLASSIFIER_CHOICES["quebec_vermont_moths_2023"]
134+
species_classifier_pipeline_choice = "quebec_vermont_moths_2023"
135+
SpeciesClassifier = CLASSIFIER_CHOICES[species_classifier_pipeline_choice]
134136
SpeciesClassifierResponse = make_algorithm_response(SpeciesClassifier)
135137

136138
# Test using a pipeline that finishes with a full species classifier
137-
pipeline_config = make_pipeline_config_response(SpeciesClassifier)
139+
pipeline_config = make_pipeline_config_response(
140+
SpeciesClassifier,
141+
slug=species_classifier_pipeline_choice,
142+
)
138143

139144
self.assertEqual(len(pipeline_config.algorithms), 3)
140145
self.assertEqual(
@@ -145,7 +150,9 @@ def test_pipeline_config_with_binary_classifier(self):
145150
)
146151

147152
# Test using a pipeline that finishes only with a binary classifier
148-
pipeline_config_binary_only = make_pipeline_config_response(BinaryClassifier)
153+
pipeline_config_binary_only = make_pipeline_config_response(
154+
BinaryClassifier, slug=binary_classifier_pipeline_choice
155+
)
149156

150157
self.assertEqual(len(pipeline_config_binary_only.algorithms), 2)
151158
self.assertEqual(

0 commit comments

Comments
 (0)