Skip to content

Commit

Permalink
refactor(test_transform): update base64 encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmedhossamdev committed Jul 7, 2024
1 parent 1b2f58e commit b51acbe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tests/sample_file.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Hello, world!\n
Hello, world!
5 changes: 3 additions & 2 deletions tests/test_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,9 @@ async def test_base64_file_input(use_async: bool) -> None:
assert await transform({"foo": "bar"}, TypedDictBase64Input, use_async) == {"foo": "bar"}

# pathlib.Path is automatically converted to base64
result = await transform({"foo": SAMPLE_FILE_PATH}, TypedDictBase64Input, use_async)
assert result["foo"] in ["SGVsbG8sIHdvcmxkIVxuCg", "SGVsbG8sIHdvcmxkIVxuDQo="] # type: ignore[comparison-overlap]
assert await transform({"foo": SAMPLE_FILE_PATH}, TypedDictBase64Input, use_async) == {
"foo": "SGVsbG8sIHdvcmxkIQ0K"
} # type: ignore[comparison-overlap]

# io instances are automatically converted to base64
assert await transform({"foo": io.StringIO("Hello, world!")}, TypedDictBase64Input, use_async) == {
Expand Down

0 comments on commit b51acbe

Please sign in to comment.