8000 Enable worker tests by antocuni · Pull Request #1757 · pyscript/pyscript · GitHub
[go: up one dir, main page]

Skip to content

Enable worker tests #1757

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix/improve this test, which was broken by the recent upgrade to pyod…
…ide 0.24.1, probably because of a different pillow version
  • Loading branch information
antocuni committed Sep 26, 2023
commit 89cb97eb491900be494b3d6fb14ce54e6aa81ae8
2 changes: 1 addition & 1 deletion pyscript.core/src/stdlib/pyscript/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"_repr_html_": "text/html",
"_repr_markdown_": "text/markdown",
"_repr_svg_": "image/svg+xml",
"_repr_png_": "image/png",
"_repr_pdf_": "application/pdf",
"_repr_jpeg_": "image/jpeg",
"_repr_png_": "image/png",
"_repr_latex": "text/latex",
"_repr_json_": "application/json",
"_repr_javascript_": "application/javascript",
Expand Down
16 changes: 6 additions & 10 deletions pyscript.core/tests/integration/test_02_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,14 +440,10 @@ def test_console_line_break(self):

@skip_worker("NEXT: display target does not work properly")
def test_image_renders_correctly(self):
"""This is just a sanity check to make sure that images are rendered correctly."""
buffer = io.BytesIO()
img = Image.new("RGB", (4, 4), color=(0, 0, 0))
img.save(buffer, format="PNG")

b64_img = base64.b64encode(buffer.getvalue()).decode("utf-8")
expected_img_src = f"data:image/png;charset=utf-8;base64,{b64_img}"

"""
This is just a sanity check to make sure that images are rendered
in a reasonable way.
"""
self.pyscript_run(
"""
<py-config>
Expand All @@ -464,5 +460,5 @@ def test_image_renders_correctly(self):
"""
)

rendered_img_src = self.page.locator("img").get_attribute("src")
assert rendered_img_src == expected_img_src
img_src = self.page.locator("img").get_attribute("src")
assert img_src.startswith('data:image/png;charset=utf-8;base64')
0