Skip to content

Commit

Permalink
test automatic reading of uris
Browse files Browse the repository at this point in the history
  • Loading branch information
rok committed Jan 5, 2024
1 parent da2fcf6 commit 984791c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Binary file added python/tests/images/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 7 additions & 4 deletions python/tests/test_pydantic.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import json
import sys
import os
from datetime import date, datetime
from typing import List, Optional, Tuple

Expand Down Expand Up @@ -234,7 +235,10 @@ class TestModel(LanceModel):
def test_lance_model_with_lance_types():
img = (b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHDR\\x00\\x00\\x00'
b'\\x01\\x00\\x00\\x00\\x01\\x08\\x06\\x00\\x00\\x00\\x1f')
default_image_uris = ImageURIArray.from_uris(["/tmp/bar"])
png_uris = [
"file://" + os.path.join(os.path.dirname(__file__), "images/1.png"),
]
default_image_uris = ImageURIArray.from_uris(png_uris)
encoded_images = pa.array([img], pa.binary())
default_encoded_images = pa.ExtensionArray.from_storage(EncodedImageType(), encoded_images)

Expand All @@ -250,6 +254,5 @@ class TestModel(LanceModel):
actual_model = TestModel(encoded_images=default_encoded_images, image_uris=default_image_uris)
assert expected_model == actual_model

# TODO: add images to repo and test with real path
# actual_model = TestModel(encoded_images=default_image_uris, image_uris=default_image_uris)
# assert expected_model == actual_model
actual_model = TestModel(encoded_images=default_image_uris, image_uris=default_image_uris)
assert expected_model == actual_model

0 comments on commit 984791c

Please sign in to comment.