Skip to content

Commit ee2599e

Browse files
author
Matt Sokoloff
committed
tests working
1 parent b1261c2 commit ee2599e

File tree

3 files changed

+22
-10
lines changed

3 files changed

+22
-10
lines changed

labelbox/data/serialization/ndjson/classification.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def from_common(
120120
ImageData]) -> "NDChecklist":
121121
return cls(answer=[
122122
NDFeature(schema_id=answer.feature_schema_id)
123-
for answer in checklist.answers
123+
for answer in checklist.answer
124124
],
125125
data_row={'id': data.uid},
126126
schema_id=feature_schema_id,

labelbox/data/serialization/ndjson/metric.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66
from labelbox.data.serialization.ndjson.base import NDJsonBase
77

88

9+
10+
911
class NDScalarMetric(NDJsonBase):
10-
metric_name: str
1112
metric_value: float
13+
metric_name: Optional[str]
1214
feature_name: Optional[str] = None
1315
subclass_name: Optional[str] = None
14-
aggregation: MetricAggregation
16+
aggregation: MetricAggregation = MetricAggregation.ARITHMETIC_MEAN.value
1517

1618
def to_common(self) -> ScalarMetric:
1719
return ScalarMetric(value=self.metric_value,
@@ -24,7 +26,7 @@ def to_common(self) -> ScalarMetric:
2426
@classmethod
2527
def from_common(cls, metric: ScalarMetric,
2628
data: Union[TextData, ImageData]) -> "NDScalarMetric":
27-
return ScalarMetric(uuid=metric.extra.get('uuid'),
29+
return cls(uuid=metric.extra.get('uuid'),
2830
metric_value=metric.value,
2931
metric_name=metric.metric_name,
3032
feature_name=metric.feature_name,
@@ -39,8 +41,8 @@ def dict(self, *args, **kwargs):
3941
res.pop(field)
4042

4143
# For backwards compatibility.
42-
if res['metric_name'] is None:
43-
res.pop('metric_name')
44+
if res['metricName'] is None:
45+
res.pop('metricName')
4446
res.pop('aggregation')
4547
return res
4648

tests/integration/mal_and_mea/conftest.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,15 +299,25 @@ def predictions(object_predictions, classification_predictions):
299299
@pytest.fixture
300300
def model(client, rand_gen, configured_project):
301301
ontology = configured_project.ontology()
302-
303302
data = {"name": rand_gen(str), "ontology_id": ontology.uid}
304-
return client.create_model(data["name"], data["ontology_id"])
305-
303+
model = client.create_model(data["name"], data["ontology_id"])
304+
yield model
305+
try:
306+
model.delete()
307+
except:
308+
# Already was deleted by the test
309+
pass
306310

307311
@pytest.fixture
308312
def model_run(rand_gen, model):
309313
name = rand_gen(str)
310-
return model.create_model_run(name)
314+
model_run = model.create_model_run(name)
315+
yield model_run
316+
try:
317+
model_run.delete()
318+
except:
319+
# Already was deleted by the test
320+
pass
311321

312322

313323
@pytest.fixture

0 commit comments

Comments
 (0)