|
12 | 12 | from urllib.error import URLError |
13 | 13 |
|
14 | 14 | import pytest |
15 | | -from narwhals.dependencies import ( |
16 | | - is_into_dataframe, |
17 | | - is_pandas_dataframe, |
18 | | - is_polars_dataframe, |
19 | | - is_pyarrow_table, |
20 | | -) |
21 | 15 | from narwhals.stable import v1 as nw |
| 16 | +from narwhals.stable.v1 import dependencies as nw_dep |
22 | 17 |
|
23 | 18 | from altair.datasets import Loader, url |
24 | 19 | from altair.datasets._readers import _METADATA, AltairDatasetsError |
@@ -227,11 +222,11 @@ def test_load_call(monkeypatch: pytest.MonkeyPatch) -> None: |
227 | 222 | default_2 = load("cars") |
228 | 223 | df_polars = load("cars", backend="polars") |
229 | 224 |
|
230 | | - assert is_polars_dataframe(default) |
231 | | - assert is_pyarrow_table(df_pyarrow) |
232 | | - assert is_pandas_dataframe(df_pandas) |
233 | | - assert is_polars_dataframe(default_2) |
234 | | - assert is_polars_dataframe(df_polars) |
| 225 | + assert nw_dep.is_polars_dataframe(default) |
| 226 | + assert nw_dep.is_pyarrow_table(df_pyarrow) |
| 227 | + assert nw_dep.is_pandas_dataframe(df_pandas) |
| 228 | + assert nw_dep.is_polars_dataframe(default_2) |
| 229 | + assert nw_dep.is_polars_dataframe(df_polars) |
235 | 230 |
|
236 | 231 |
|
237 | 232 | @pytest.mark.parametrize( |
@@ -320,7 +315,7 @@ def test_loader_call(backend: _Backend, monkeypatch: pytest.MonkeyPatch) -> None |
320 | 315 |
|
321 | 316 | data = Loader.from_backend(backend) |
322 | 317 | frame = data("stocks", ".csv") |
323 | | - assert is_into_dataframe(frame) |
| 318 | + assert nw_dep.is_into_dataframe(frame) |
324 | 319 | nw_frame = nw.from_native(frame) |
325 | 320 | assert set(nw_frame.columns) == {"symbol", "date", "price"} |
326 | 321 |
|
@@ -493,7 +488,7 @@ def test_reader_cache( |
493 | 488 | cached_paths = tuple(data.cache) |
494 | 489 | assert len(cached_paths) == 4 |
495 | 490 |
|
496 | | - if is_polars_dataframe(lookup_groups): |
| 491 | + if nw_dep.is_polars_dataframe(lookup_groups): |
497 | 492 | left, right = ( |
498 | 493 | lookup_groups, |
499 | 494 | cast(pl.DataFrame, data("lookup_groups", tag="v2.5.3")), |
@@ -664,7 +659,7 @@ def test_all_datasets( |
664 | 659 | ) -> None: |
665 | 660 | """Ensure all annotated datasets can be loaded with the most reliable backend.""" |
666 | 661 | frame = polars_loader(name, suffix, tag=tag) |
667 | | - assert is_polars_dataframe(frame) |
| 662 | + assert nw_dep.is_polars_dataframe(frame) |
668 | 663 |
|
669 | 664 |
|
670 | 665 | def _raise_exception(e: type[Exception], *args: Any, **kwds: Any): |
@@ -698,7 +693,7 @@ def test_no_remote_connection(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) - |
698 | 693 |
|
699 | 694 | # Now we can get a cache-hit |
700 | 695 | frame = data("birdstrikes") |
701 | | - assert is_polars_dataframe(frame) |
| 696 | + assert nw_dep.is_polars_dataframe(frame) |
702 | 697 | assert len(tuple(tmp_path.iterdir())) == 4 |
703 | 698 |
|
704 | 699 | with monkeypatch.context() as mp: |
|
0 commit comments