Skip to content

Commit 1691706

Browse files
committed
reimplement __str__ which was removed during refactor
1 parent f7c1443 commit 1691706

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

tests/unit_tests/images/test_images.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import json
2+
13
import responses # https://github.com/getsentry/responses
24
from responses import matchers
35

@@ -35,6 +37,7 @@ def test_images(http_client):
3537
assert isinstance(images[0].details, list)
3638
assert images[0].details[0] == 'Ubuntu 20.04'
3739
assert images[0].details[1] == 'CUDA 11.0'
40+
assert json.loads(str(images[0])) == IMAGE_RESPONSE
3841

3942

4043
def test_images_filter_by_instance_type(http_client):

verda/images/_images.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ class Image:
2222
image_type: str
2323
details: list[str]
2424

25+
def __str__(self) -> str:
26+
return self.to_json(indent=2)
27+
2528

2629
class ImagesService:
2730
"""A service for interacting with the images endpoint."""

0 commit comments

Comments
 (0)