Skip to content

Commit c2b558f

Browse files
committed
Fixed image_url vs. location bug and pytest bug
1 parent ebbf257 commit c2b558f

File tree

7 files changed

+47
-11
lines changed

7 files changed

+47
-11
lines changed

nucleus/dataset_item.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class DatasetItem:
1919
metadata: dict = None
2020

2121
def __post_init__(self):
22+
self.image_url = self.image_location
2223
self.local = self._is_local_path(self.image_location)
2324

2425
@classmethod

tests/test_annotation.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@
2121
)
2222
from nucleus.constants import ERROR_PAYLOAD
2323

24-
# Have to define here in order to have access to all relevant objects
25-
def test_repr(test_object: any):
26-
assert eval(str(test_object)) == test_object
24+
2725

2826
def test_reprs():
27+
# Have to define here in order to have access to all relevant objects
28+
def test_repr(test_object: any):
29+
assert eval(str(test_object)) == test_object
2930
[
3031
test_repr(SegmentationAnnotation.from_json(_))
3132
for _ in TEST_SEGMENTATION_ANNOTATIONS

tests/test_dataset.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@
1919
)
2020

2121

22-
# Have to define here in order to have access to all relevant objects
23-
def test_repr(test_object: any):
24-
assert eval(str(test_object)) == test_object
22+
2523

2624
def test_reprs():
25+
# Have to define here in order to have access to all relevant objects
26+
def test_repr(test_object: any):
27+
assert eval(str(test_object)) == test_object
2728
test_repr(DatasetItem(
2829
image_location="test_url",
2930
reference_id="test_reference_id",

tests/test_models.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@
2424
TEST_PREDS,
2525
)
2626

27-
# Have to define here in order to have access to all relevant objects
28-
def test_repr(test_object: any):
29-
assert eval(str(test_object)) == test_object
27+
3028

3129
def test_reprs():
30+
# Have to define here in order to have access to all relevant objects
31+
def test_repr(test_object: any):
32+
assert eval(str(test_object)) == test_object
3233
client = NucleusClient(api_key="fake_key")
3334
test_repr(Model(client=client, model_id="fake_model_id", name="fake_name", reference_id="fake_reference_id", metadata={"fake": "metadata"}))
3435
test_repr(ModelRun(client=client, model_run_id="fake_model_run_id"))

tests/test_prediction.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@
2525
from nucleus.constants import ERROR_PAYLOAD
2626

2727

28-
def test_repr(test_object: any):
29-
assert eval(str(test_object)) == test_object
28+
3029

3130

3231
def test_reprs():
32+
def test_repr(test_object: any):
33+
assert eval(str(test_object)) == test_object
3334
[
3435
test_repr(SegmentationPrediction.from_json(_))
3536
for _ in TEST_SEGMENTATION_PREDICTIONS

tests/test_slice.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import pytest
2+
from nucleus import (
3+
Slice,
4+
NucleusClient
5+
)
6+
7+
8+
9+
def test_reprs():
10+
# Have to define here in order to have access to all relevant objects
11+
def test_repr(test_object: any):
12+
assert eval(str(test_object)) == test_object
13+
client = NucleusClient(api_key="fake_key")
14+
test_repr(Slice(slice_id="fake_slice_id", client=client))

tests/test_upload_response.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import pytest
2+
from nucleus import (
3+
Slice,
4+
UploadResponse
5+
)
6+
7+
8+
from nucleus.constants import (
9+
DATASET_ID_KEY,
10+
)
11+
12+
13+
def test_reprs():
14+
# Have to define here in order to have access to all relevant objects
15+
def test_repr(test_object: any):
16+
assert eval(str(test_object)) == test_object
17+
test_repr(UploadResponse(json = {DATASET_ID_KEY: "fake_dataset_id_key"}))

0 commit comments

Comments
 (0)