Skip to content

Commit

Permalink
chore: factor drop_test out of test_common (#586)
Browse files Browse the repository at this point in the history
Co-authored-by: Marco Edward Gorelli <[email protected]>
  • Loading branch information
aidoskanapyanov and MarcoGorelli authored Jul 23, 2024
1 parent a4028e9 commit 17c07b2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
21 changes: 21 additions & 0 deletions tests/frame/drop_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from __future__ import annotations

from typing import Any

import pytest

import narwhals.stable.v1 as nw


@pytest.mark.parametrize(
("drop", "left"),
[
(["a"], ["b", "z"]),
(["a", "b"], ["z"]),
],
)
def test_drop(constructor: Any, drop: list[str], left: list[str]) -> None:
data = {"a": [1, 3, 2], "b": [4, 4, 6], "z": [7.0, 8, 9]}
df = nw.from_native(constructor(data))
assert df.drop(drop).columns == left
assert df.drop(*drop).columns == left
13 changes: 0 additions & 13 deletions tests/frame/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,19 +156,6 @@ def test_expr_na(constructor_with_lazy: Any) -> None:
compare_dicts(result_nna, expected)


@pytest.mark.parametrize(
("drop", "left"),
[
(["a"], ["b", "z"]),
(["a", "b"], ["z"]),
],
)
def test_drop(constructor: Any, drop: list[str], left: list[str]) -> None:
df = nw.from_native(constructor(data))
assert df.drop(drop).columns == left
assert df.drop(*drop).columns == left


def test_lazy(constructor: Any) -> None:
df = nw.from_native(constructor({"a": [1, 2, 3]}), eager_only=True)
result = df.lazy()
Expand Down

0 comments on commit 17c07b2

Please sign in to comment.