-
Notifications
You must be signed in to change notification settings - Fork 177
ci: bump ruff==0.15.0
#3449
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
ci: bump ruff==0.15.0
#3449
Changes from 7 commits
0a113f1
a02492c
3c663f0
74e0df1
e310804
b144f1e
6d5e3d5
4d63445
dcc4c2a
af03e02
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -9,7 +9,13 @@ | |||||||||
|
|
||||||||||
| import narwhals as nw | ||||||||||
| from narwhals.exceptions import InvalidOperationError, PerformanceWarning | ||||||||||
| from tests.utils import PANDAS_VERSION, POLARS_VERSION, PYARROW_VERSION, pyspark_session | ||||||||||
| from tests.utils import ( | ||||||||||
| PANDAS_VERSION, | ||||||||||
| POLARS_VERSION, | ||||||||||
| PYARROW_VERSION, | ||||||||||
| assert_equal_hash, | ||||||||||
| pyspark_session, | ||||||||||
| ) | ||||||||||
|
|
||||||||||
| if TYPE_CHECKING: | ||||||||||
| from collections.abc import Iterable | ||||||||||
|
|
@@ -68,7 +74,7 @@ def test_list_valid() -> None: | |||||||||
| assert dtype == nw.List(nw.List(nw.Int64)) | ||||||||||
| assert dtype == nw.List | ||||||||||
| assert dtype != nw.List(nw.List(nw.Float32)) | ||||||||||
| assert dtype in {nw.List(nw.List(nw.Int64))} | ||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are we sure about changing this? wouldn't we still want to test that like this it feels like we're testing implementation details, it may be better to just noqa it?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about a function (with whatever in it), that has a name more fitting to the test? E.g. - assert dtype in {nw.List(nw.List(nw.Int64))}
+ assert_hash_equals(dtype, nw.List(nw.List(nw.Int64)))I actually applied the auto-fix first, before realizing it changed the thing we test. That seems like a pretty easy mistake to make and I might not have caught it without knowing the implementation detail 😅 Edit: Well I managed to do it in the same commit by only getting the first one right 🤦♂️ Lines 534 to 537 in b144f1e
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure!
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hopefully this'll do 🙂 (6d5e3d5) > assert_equal_hash(dtype, nw.Enum(["a", "b", "c"]))
E AssertionError: inputs do not compare equal by `__hash__`
E [left]: Enum(categories=['a', 'b'])
E [right]: Enum(categories=['a', 'b', 'c'])
tests/dtypes/dtypes_test.py:548: AssertionErrorBased on what's in |
||||||||||
| assert_equal_hash(dtype, nw.List(nw.List(nw.Int64))) | ||||||||||
|
|
||||||||||
|
|
||||||||||
| def test_array_valid() -> None: | ||||||||||
|
|
@@ -83,7 +89,7 @@ def test_array_valid() -> None: | |||||||||
| assert dtype == nw.Array(nw.Array(nw.Int64, 2), 2) | ||||||||||
| assert dtype == nw.Array | ||||||||||
| assert dtype != nw.Array(nw.Array(nw.Float32, 2), 2) | ||||||||||
| assert dtype in {nw.Array(nw.Array(nw.Int64, 2), 2)} | ||||||||||
| assert_equal_hash(dtype, nw.Array(nw.Array(nw.Int64, 2), 2)) | ||||||||||
|
|
||||||||||
| with pytest.raises(TypeError, match="invalid input for shape"): | ||||||||||
| nw.Array(nw.Int64(), shape=None) # type: ignore[arg-type] | ||||||||||
|
|
@@ -105,7 +111,7 @@ def test_struct_valid() -> None: | |||||||||
| assert dtype.to_schema() == nw.Struct({"a": nw.Int64, "b": nw.String}).to_schema() | ||||||||||
| assert dtype == nw.Struct | ||||||||||
| assert dtype != nw.Struct({"a": nw.Int32, "b": nw.String}) | ||||||||||
| assert dtype in {nw.Struct({"a": nw.Int64, "b": nw.String})} | ||||||||||
| assert_equal_hash(dtype, nw.Struct({"a": nw.Int64, "b": nw.String})) | ||||||||||
|
|
||||||||||
|
|
||||||||||
| def test_struct_reverse() -> None: | ||||||||||
|
|
@@ -535,8 +541,10 @@ def test_enum_repr() -> None: | |||||||||
|
|
||||||||||
|
|
||||||||||
| def test_enum_hash() -> None: | ||||||||||
| assert nw.Enum(["a", "b"]) in {nw.Enum(["a", "b"])} | ||||||||||
| assert nw.Enum(["a", "b"]) not in {nw.Enum(["a", "b", "c"])} | ||||||||||
| dtype = nw.Enum(["a", "b"]) | ||||||||||
| assert_equal_hash(dtype, nw.Enum(["a", "b"])) | ||||||||||
| with pytest.raises(AssertionError): | ||||||||||
| assert_equal_hash(dtype, nw.Enum(["a", "b", "c"])) | ||||||||||
|
|
||||||||||
|
|
||||||||||
| @pytest.mark.xfail( | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😄 nice