Skip to content

Instantly share code, notes, and snippets.

@tdsmith
Created July 4, 2024 19:21
Show Gist options
  • Save tdsmith/09863e596809121ec15001669440cf5d to your computer and use it in GitHub Desktop.
Save tdsmith/09863e596809121ec15001669440cf5d to your computer and use it in GitHub Desktop.
#
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile
#
iniconfig==2.0.0
# via pytest
packaging==24.1
# via pytest
pluggy==1.5.0
# via pytest
polars==1.0.0
# via -r requirements.in
pytest==8.2.2
# via -r requirements.in
import io
import polars as pl
import pytest
fixture = """\
first_name,last_name
josé,österlung
additional,content
"""
@pytest.mark.parametrize(
("k",),
[
(50,),
# raises OSError: failed to write whole buffer
pytest.param(500, marks=pytest.mark.xfail(raises=OSError)),
],
)
def test_textwrapper(k: int):
long_fixture = fixture * k
fixture_bytes = io.BytesIO(long_fixture.encode("latin1"))
wrapper = io.TextIOWrapper(fixture_bytes, "latin1", "replace")
pl.read_csv(wrapper)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment