Skip to content

Commit

Permalink
mob next [ci-skip] [ci skip] [skip ci]
Browse files Browse the repository at this point in the history
lastFile:tests/unit/test_project.py
  • Loading branch information
thomass-dev committed Sep 11, 2024
1 parent 9fa640d commit d6df45c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
13 changes: 2 additions & 11 deletions src/skore/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,6 @@ class ItemType(StrEnum):
MEDIA = auto()


# FIXME: attensssion parlezen à thomas experience déguelasse
# s.put_item(
# "HTML",
# Item(
# serialized=markup,
# raw=markup,
# media_type="text/html",
# item_type=ItemType.MEDIA,
# ),
# )
@dataclass(frozen=True)
class Item:
"""A value that is stored in a Project."""
Expand Down Expand Up @@ -111,8 +101,9 @@ def deserialize(
raw = json.loads(serialized)
case ItemType.PANDAS_DATAFRAME:
import pandas
import io

raw = pandas.read_json(serialized, orient="split")
raw = pandas.read_json(io.StringIO(serialized), orient="split")
case ItemType.NUMPY_ARRAY:
import numpy

Expand Down
11 changes: 9 additions & 2 deletions tests/unit/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
from skore.storage.non_persistent_storage import NonPersistentStorage



# import PIL
# image = PIL.Image.new(mode="RGB", size=(200, 200))
# image.show()


def test_transform_primitive():
o = 3
actual = serialize(o)
Expand Down Expand Up @@ -173,7 +179,8 @@ def savefig(*args, **kwargs):
project.put("mpl_figure", fig) # MediaItem (SVG)

# Add an Altair chart
project.put("vega_chart", altair.Chart().mark_point())
altair_chart = altair.Chart().mark_point()
project.put("vega_chart", altair_chart)

# Add a PIL Image
# pil_image = Image.new("RGB", (100, 100), color="red")
Expand Down Expand Up @@ -241,7 +248,7 @@ def savefig(*args, **kwargs):
},
"vega_chart": {
"item_type": str(ItemType.ALTAIR_CHART),
"serialized": "",
"serialized": json.dumps(altair_chart.to_dict()),
"media_type": None,
},
}
Expand Down

0 comments on commit d6df45c

Please sign in to comment.