Skip to content

Address warnings in tests - #359

Merged
ofajardo merged 1 commit into
Roche:devfrom
hpoettker:narwhals-deprecation-warning
Nov 24, 2026
Merged

ofajardo merged 1 commit into
Roche:devfrom
hpoettker:narwhals-deprecation-warning

Conversation

@hpoettker

Copy link
Copy Markdown
Contributor

Just fixes a deprecation warning in the tests:

test_narwhalified.py:1364: DeprecationWarning: `Series.cat.get_categories` is deprecated and it will be removed in a future version.

To get the distinct values present in a Categorical column, use `Series.unique`.
For the fixed category list of an Enum, use its `dtype.categories`.

Note: `cat.get_categories` will remain available in `narwhals.stable.v1` and `narwhals.stable.v2`.
See https://narwhals-dev.github.io/narwhals/backcompat/ for more information.

categories = nw.from_native(df)["Col1"].cat.get_categories().to_list()

@hpoettker
hpoettker changed the base branch from master to dev November 19, 2026 21:17
@hpoettker
hpoettker force-pushed the narwhals-deprecation-warning branch from 1458e2b to 7e7b778 Compare November 24, 2026 08:15
@hpoettker hpoettker changed the title Address narwhals deprecation warning Address warnings in tests Nov 24, 2026
@hpoettker

Copy link
Copy Markdown
Contributor Author

I've added a second fix for a warning in the HTTP integration tests:

C:\hostedtoolcache\windows\Python\3.13.17\x64\Lib\contextlib.py:148: ResourceWarning: unclosed <socket.socket fd=540, family=2, type=1, proto=0, laddr=('127.0.0.1', 57160)>
  next(self.gen)
ResourceWarning: Enable tracemalloc to get the object allocation traceback

@ofajardo

Copy link
Copy Markdown
Collaborator

thanks!

@ofajardo
ofajardo merged commit 3a25cc9 into Roche:dev Nov 24, 2026
3 checks passed
@hpoettker
hpoettker deleted the narwhals-deprecation-warning branch November 24, 2026 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants