-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
chore: Increase categorical test coverage #20514
Conversation
06c62f9
to
ecd05cc
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #20514 +/- ##
==========================================
+ Coverage 78.99% 79.00% +0.01%
==========================================
Files 1564 1564
Lines 220618 220618
Branches 2502 2502
==========================================
+ Hits 174281 174305 +24
+ Misses 45763 45739 -24
Partials 574 574 ☔ View full report in Codecov by Sentry. |
291aef0
to
156db92
Compare
This also fixes the flaky doctests but I see there's already a PR for this: #20516. |
Can you rebase and see if all is fixed now? |
@ritchie46 rebased. Still seeing errors in import polars as pl
pl.enable_string_cache()
pl.Series(["aaa", "bbb", "ccc"], dtype=pl.Categorical) # pre-fill cache
# test_compare_categorical_single
pl.Series(["a"], dtype=pl.Categorical) < "a"
# pyo3_runtime.PanicException: assertion failed: i < self.len()
# test_unique_categorical
pl.Series(["a"], dtype=pl.Categorical).unique()
# pyo3_runtime.PanicException: assertion failed: TotalOrd::tot_le(v, self.range.end()) |
Alright, fixing those. |
8d69f1e
to
df9b69b
Compare
df9b69b
to
f76ca02
Compare
@ritchie46 this one is now all up-to-date. I've removed all of the |
This PR adds a fixture (well--moved from a previous PR that only used it in a few specific tests) for use in categorical testing. When used via
@pytest.mark.usefixtures("test_global_and_local")
, it runs the test in both a local and global context. When the global context is used, the global cache is populated by a few strings so that the physical values do not match the local values.There were a few tests that used
@StringCache()
but had no local testing, so I converted these to use the updated fixture, which tests both. I avoided touching tests that manually tested for local or global conditions.In the process, I uncovered three tests that failed in a global context, and marked these with a
# TODO: fails with global string cache
and disabled the fixture for these tests. One of these tests (the third below) I enhanced slightly in order to trigger the error (which required testing withoutmaintain_order=True
). I've listed them below with repros so that we can open new issues for these.test_compare_categorical_single
test_fast_unique_flag_from_arrow
test_unique_categorical
This is open in issue
#20484#20528.