Skip to content

Commit 93aa7f7

Browse files
committed
fix
1 parent ceec3a1 commit 93aa7f7

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ include = [
5757
]
5858

5959
[tool.pytest.ini_options]
60+
pythonpath = ["src", "."]
6061
addopts = "-q"
6162
testpaths = ["tests"]
6263

requirements.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
build
2+
mypy
3+
pytest
4+
ruff
5+
twine
6+
pydantic

src/openinflation_dataclass/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@
66
from .geolocation import AdministrativeUnit, RetailUnit, Schedule
77
from .serialization import from_json, to_json
88
from .tree import Category
9-
from .types import Base64BytesIO, NetworkModel
9+
from .types import NetworkModel
1010

1111
__all__ = [
1212
"AdministrativeUnit",
13-
"Base64BytesIO",
1413
"Card",
1514
"Category",
1615
"MetaData",

tests/test_models.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from __future__ import annotations
22

3-
from io import BytesIO
4-
53
import pytest
64
from pydantic import ValidationError
75

@@ -47,8 +45,8 @@ def _build_card() -> Card:
4745
package_quantity=1.0,
4846
package_unit="LTR",
4947
categories_uid=["milk"],
50-
main_image=BytesIO(b"main-image"),
51-
images=[BytesIO(b"image-1"), BytesIO(b"image-2")],
48+
main_image="main-image.png",
49+
images=["image-1.png", "image-2.png"],
5250
)
5351

5452

@@ -58,7 +56,7 @@ def _build_retail_unit() -> RetailUnit:
5856
alias="milk",
5957
title="Milk",
6058
adult=False,
61-
icon=BytesIO(b"icon"),
59+
icon="icon.png",
6260
)
6361
admin = AdministrativeUnit(
6462
settlement_type="city",
@@ -92,9 +90,9 @@ def test_round_trip_retail_unit_json() -> None:
9290

9391
assert isinstance(restored, RetailUnit)
9492
assert restored.products[0].sku == "SKU-001"
95-
assert restored.products[0].main_image.getvalue() == b"main-image"
93+
assert restored.products[0].main_image == "main-image.png"
9694
assert restored.categories[0].icon is not None
97-
assert restored.categories[0].icon.getvalue() == b"icon"
95+
assert restored.categories[0].icon == "icon.png"
9896

9997

10098
def test_round_trip_list_of_cards_json() -> None:
@@ -103,7 +101,7 @@ def test_round_trip_list_of_cards_json() -> None:
103101

104102
assert isinstance(restored, list)
105103
assert isinstance(restored[0], Card)
106-
assert restored[0].images[1].getvalue() == b"image-2"
104+
assert restored[0].images[1] == "image-2.png"
107105

108106

109107
def test_card_piece_validation_rejects_float_count() -> None:
@@ -138,7 +136,7 @@ def test_card_piece_validation_rejects_float_count() -> None:
138136
package_quantity=1.0,
139137
package_unit="LTR",
140138
categories_uid=["milk"],
141-
main_image=BytesIO(b"main-image"),
139+
main_image="main-image.png",
142140
)
143141

144142

0 commit comments

Comments
 (0)