Skip to content

Commit

Permalink
Tests: A few improvements to to_bytes and acquire_html tests
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Apr 14, 2024
1 parent ab83b4e commit 885f3b5
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions test/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,7 @@ def test_to_bytes(ie: ImageEngine):
ie.crop((50, 50, 100, 100))
buffer = ie.to_bytes()

assert False \
or buffer.startswith(b"\x80") \
or buffer.startswith(b"\x7f") \
or buffer.startswith(b"{")
assert isinstance(buffer, bytes)


def test_acquire_html_full():
Expand All @@ -116,10 +113,9 @@ def test_acquire_html_full():

ie.acquire("https://example.org/")
ie.read()
buffer = ie.to_bytes()
buffer = ie.to_buffer("png", dpi=72)

# TODO: Why doesn't this employ a PNG header?
assert buffer.startswith(b"\xf0\xf0\xf2\xff\xf0\xf0\xf2")
assert buffer.startswith(b"\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR")


def test_acquire_html_partial():
Expand All @@ -130,7 +126,6 @@ def test_acquire_html_partial():

ie.acquire("https://example.org/", dom_selector="h1")
ie.read()
buffer = ie.to_bytes()
buffer = ie.to_buffer("png", dpi=72)

# TODO: Why doesn't this employ a PNG header?
assert buffer.startswith(b"\xfd\xfd\xff\xff\xfd")
assert buffer.startswith(b"\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR")

0 comments on commit 885f3b5

Please sign in to comment.