When I added unpack_buffer_archive, in code review people said
it was redundant with unpack_buffer and they should be merged.
I said merging was too annoying. They were right. This merges
the functions together into a function with a 38 line docstring
and a 18 line implementation.
Merge together unpack_buffer and unpack_buffer_archive. When I added unpack_buffer_archive, in code review people said
it was redundant with unpack_buffer and they should be merged.
I said merging was too annoying. They were right. This merges
the functions together into a function with a 38 line docstring
and a 18 line implementation.
from pyodide_build.testing import run_in_pyodide


@run_in_pyodide
def test_bz2():
    import bz2

    text = "Hello test test test test this is a test test test"
    some_compressed_bytes = bz2.compress(text.encode("utf-8"))
    assert some_compressed_bytes != text
    decompressed_bytes = bz2.decompress(some_compressed_bytes)
    assert decompressed_bytes.decode("utf-8") == text

from pyodide_build.testing import run_in_pyodide


@run_in_pyodide
def test_bz2():
    import bz2

    text = "Hello test test test test this is a test test test"
    some_compressed_bytes = bz2.compress(text.encode("utf-8"))
    assert some_compressed_bytes != text
    decompressed_bytes = bz2.decompress(some_compressed_bytes)
    assert decompressed_bytes.decode("utf-8") == text
