Blob: Add validator and use future annotations (#3650)

Minor changes to the Blob schema.

---------

Co-authored-by: Zander Chase <130414180+vowelparrot@users.noreply.github.com>
This commit is contained in:
Eugene Yurtsev
2023-04-27 14:33:59 -04:00
committed by GitHub
parent c5a4b4fea1
commit 708787dddb
2 changed files with 22 additions and 4 deletions

View File

@@ -90,6 +90,15 @@ def test_mime_type_inference(
assert blob.mimetype == expected_mime_type
def test_blob_initialization_validator() -> None:
"""Test that blob initialization validates the arguments."""
with pytest.raises(ValueError, match="Either data or path must be provided"):
Blob()
assert Blob(data=b"Hello, World!") is not None
assert Blob(path="some_path") is not None
def test_blob_loader() -> None:
"""Simple test that verifies that we can implement a blob loader."""