Skip to content

Commit

Permalink
Revert global for specific tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mcrumiller committed Dec 31, 2024
1 parent 2399d46 commit 06c62f9
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions py-polars/tests/unit/io/test_parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -2456,39 +2456,39 @@ def test_categorical_sliced_20017() -> None:
name="mask", dtype=pl.Boolean, min_size=7, max_size=7, allow_null=False
),
)
@pytest.mark.usefixtures("test_global_and_local")
def test_categorical_parametric_masked(s: pl.Series, mask: pl.Series) -> None:
f = io.BytesIO()

df = pl.DataFrame([s, mask]).with_columns(pl.col.a.cast(pl.Categorical))
df.write_parquet(f)
with pl.StringCache():
df = pl.DataFrame([s, mask]).with_columns(pl.col.a.cast(pl.Categorical))
df.write_parquet(f)

f.seek(0)
assert_frame_equal(
pl.scan_parquet(f, parallel="prefiltered").filter(pl.col.mask).collect(),
df.filter(pl.col.mask),
)
f.seek(0)
assert_frame_equal(
pl.scan_parquet(f, parallel="prefiltered").filter(pl.col.mask).collect(),
df.filter(pl.col.mask),
)


@given(
s=series(name="a", dtype=pl.String, min_size=7, max_size=7),
start=st.integers(0, 6),
length=st.integers(1, 7),
)
@pytest.mark.usefixtures("test_global_and_local")
def test_categorical_parametric_sliced(s: pl.Series, start: int, length: int) -> None:
length = min(7 - start, length)

f = io.BytesIO()

df = s.to_frame().with_columns(pl.col.a.cast(pl.Categorical))
df.write_parquet(f)
with pl.StringCache():
df = s.to_frame().with_columns(pl.col.a.cast(pl.Categorical))
df.write_parquet(f)

f.seek(0)
assert_frame_equal(
pl.scan_parquet(f).slice(start, length).collect(),
df.slice(start, length),
)
f.seek(0)
assert_frame_equal(
pl.scan_parquet(f).slice(start, length).collect(),
df.slice(start, length),
)


@pytest.mark.write_disk
Expand Down

0 comments on commit 06c62f9

Please sign in to comment.