Skip to content

Commit 0358cc9

Browse files
committed
test: Insane LazyFrame coverage
Absolutely not doing this with another class
1 parent 94029ed commit 0358cc9

File tree

1 file changed

+164
-0
lines changed

1 file changed

+164
-0
lines changed

tests/translate/from_native_test.py

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,170 @@ def test_eager_only_pass_through_main(constructor: Constructor) -> None:
454454
nw.from_native(df, eager_only=True, pass_through=False) # type: ignore[type-var]
455455

456456

457+
def test_from_native_lazyframe_exhaustive() -> None: # noqa: PLR0914, PLR0915
458+
pytest.importorskip("polars")
459+
pytest.importorskip("typing_extensions")
460+
461+
import polars as pl
462+
from typing_extensions import assert_type
463+
464+
pl_ldf = pl.LazyFrame(data)
465+
466+
pl_1 = nw.from_native(pl_ldf)
467+
pl_2 = nw.from_native(pl_ldf, pass_through=False)
468+
pl_3 = nw.from_native(pl_ldf, pass_through=True)
469+
pl_4 = nw.from_native(pl_ldf, eager_only=False)
470+
pl_5 = nw.from_native(pl_ldf, series_only=False)
471+
pl_6 = nw.from_native(pl_ldf, allow_series=False)
472+
pl_7 = nw.from_native(pl_ldf, allow_series=None)
473+
pl_8 = nw.from_native(pl_ldf, allow_series=True)
474+
pl_9 = nw.from_native(pl_ldf, pass_through=False, eager_only=False)
475+
pl_10 = nw.from_native(pl_ldf, pass_through=True, eager_only=False)
476+
pl_11 = nw.from_native(
477+
pl_ldf, pass_through=False, eager_only=False, series_only=False
478+
)
479+
pl_12 = nw.from_native(pl_ldf, pass_through=True, eager_only=False, series_only=False)
480+
pl_13 = nw.from_native(
481+
pl_ldf, pass_through=False, eager_only=False, allow_series=False
482+
)
483+
pl_14 = nw.from_native(
484+
pl_ldf, pass_through=True, eager_only=False, allow_series=False
485+
)
486+
pl_15 = nw.from_native(
487+
pl_ldf,
488+
pass_through=False,
489+
eager_only=False,
490+
series_only=False,
491+
allow_series=False,
492+
)
493+
pl_16 = nw.from_native(
494+
pl_ldf, pass_through=True, eager_only=False, series_only=False, allow_series=False
495+
)
496+
pl_17 = nw.from_native(
497+
pl_ldf, pass_through=False, eager_only=False, allow_series=None
498+
)
499+
pl_18 = nw.from_native(pl_ldf, pass_through=True, eager_only=False, allow_series=None)
500+
pl_19 = nw.from_native(
501+
pl_ldf, pass_through=False, eager_only=False, series_only=False, allow_series=None
502+
)
503+
pl_20 = nw.from_native(
504+
pl_ldf, pass_through=True, eager_only=False, series_only=False, allow_series=None
505+
)
506+
pl_21 = nw.from_native(
507+
pl_ldf, pass_through=False, eager_only=False, allow_series=True
508+
)
509+
pl_21 = nw.from_native(pl_ldf, pass_through=True, eager_only=False, allow_series=True)
510+
pl_21 = nw.from_native(
511+
pl_ldf, pass_through=False, eager_only=False, series_only=False, allow_series=True
512+
)
513+
pl_22 = nw.from_native(
514+
pl_ldf, pass_through=True, eager_only=False, series_only=False, allow_series=True
515+
)
516+
pl_23 = nw.from_native(pl_ldf, eager_only=False, series_only=False)
517+
pl_24 = nw.from_native(pl_ldf, eager_only=False, allow_series=False)
518+
pl_25 = nw.from_native(
519+
pl_ldf, eager_only=False, series_only=False, allow_series=False
520+
)
521+
pl_26 = nw.from_native(pl_ldf, eager_only=False, allow_series=None)
522+
pl_27 = nw.from_native(pl_ldf, eager_only=False, series_only=False, allow_series=None)
523+
pl_28 = nw.from_native(pl_ldf, eager_only=False, allow_series=True)
524+
pl_29 = nw.from_native(pl_ldf, eager_only=False, series_only=False, allow_series=True)
525+
pl_30 = nw.from_native(
526+
pl_ldf, pass_through=False, series_only=False, allow_series=None
527+
)
528+
pl_31 = nw.from_native(
529+
pl_ldf, pass_through=False, series_only=False, allow_series=False
530+
)
531+
pl_32 = nw.from_native(
532+
pl_ldf, pass_through=False, series_only=False, allow_series=True
533+
)
534+
pl_33 = nw.from_native(
535+
pl_ldf, pass_through=True, series_only=False, allow_series=None
536+
)
537+
pl_34 = nw.from_native(
538+
pl_ldf, pass_through=True, series_only=False, allow_series=False
539+
)
540+
pl_35 = nw.from_native(
541+
pl_ldf, pass_through=True, series_only=False, allow_series=True
542+
)
543+
pls = (
544+
pl_1,
545+
pl_2,
546+
pl_3,
547+
pl_4,
548+
pl_5,
549+
pl_6,
550+
pl_7,
551+
pl_8,
552+
pl_9,
553+
pl_10,
554+
pl_11,
555+
pl_12,
556+
pl_13,
557+
pl_14,
558+
pl_15,
559+
pl_16,
560+
pl_17,
561+
pl_18,
562+
pl_19,
563+
pl_20,
564+
pl_21,
565+
pl_22,
566+
pl_23,
567+
pl_24,
568+
pl_25,
569+
pl_26,
570+
pl_27,
571+
pl_28,
572+
pl_29,
573+
pl_30,
574+
pl_31,
575+
pl_32,
576+
pl_33,
577+
pl_34,
578+
pl_35,
579+
)
580+
581+
assert_type(pl_1, nw.LazyFrame[pl.LazyFrame])
582+
assert_type(pl_2, nw.LazyFrame[pl.LazyFrame])
583+
assert_type(pl_3, nw.LazyFrame[pl.LazyFrame])
584+
assert_type(pl_4, nw.LazyFrame[pl.LazyFrame])
585+
assert_type(pl_5, nw.LazyFrame[pl.LazyFrame])
586+
assert_type(pl_6, nw.LazyFrame[pl.LazyFrame])
587+
assert_type(pl_7, nw.LazyFrame[pl.LazyFrame])
588+
assert_type(pl_8, nw.LazyFrame[pl.LazyFrame])
589+
assert_type(pl_9, nw.LazyFrame[pl.LazyFrame])
590+
assert_type(pl_10, nw.LazyFrame[pl.LazyFrame])
591+
assert_type(pl_11, nw.LazyFrame[pl.LazyFrame])
592+
assert_type(pl_12, nw.LazyFrame[pl.LazyFrame])
593+
assert_type(pl_13, nw.LazyFrame[pl.LazyFrame])
594+
assert_type(pl_14, nw.LazyFrame[pl.LazyFrame])
595+
assert_type(pl_15, nw.LazyFrame[pl.LazyFrame])
596+
assert_type(pl_16, nw.LazyFrame[pl.LazyFrame])
597+
assert_type(pl_17, nw.LazyFrame[pl.LazyFrame])
598+
assert_type(pl_18, nw.LazyFrame[pl.LazyFrame])
599+
assert_type(pl_19, nw.LazyFrame[pl.LazyFrame])
600+
assert_type(pl_20, nw.LazyFrame[pl.LazyFrame])
601+
assert_type(pl_21, nw.LazyFrame[pl.LazyFrame])
602+
assert_type(pl_22, nw.LazyFrame[pl.LazyFrame])
603+
assert_type(pl_23, nw.LazyFrame[pl.LazyFrame])
604+
assert_type(pl_24, nw.LazyFrame[pl.LazyFrame])
605+
assert_type(pl_25, nw.LazyFrame[pl.LazyFrame])
606+
assert_type(pl_26, nw.LazyFrame[pl.LazyFrame])
607+
assert_type(pl_27, nw.LazyFrame[pl.LazyFrame])
608+
assert_type(pl_28, nw.LazyFrame[pl.LazyFrame])
609+
assert_type(pl_29, nw.LazyFrame[pl.LazyFrame])
610+
assert_type(pl_30, nw.LazyFrame[pl.LazyFrame])
611+
assert_type(pl_31, nw.LazyFrame[pl.LazyFrame])
612+
assert_type(pl_32, nw.LazyFrame[pl.LazyFrame])
613+
assert_type(pl_33, nw.LazyFrame[pl.LazyFrame])
614+
assert_type(pl_34, nw.LazyFrame[pl.LazyFrame])
615+
assert_type(pl_35, nw.LazyFrame[pl.LazyFrame])
616+
617+
for ldf in pls:
618+
assert isinstance(ldf, nw.LazyFrame)
619+
620+
457621
def test_from_native_series_exhaustive() -> None: # noqa: PLR0914, PLR0915
458622
pytest.importorskip("polars")
459623
pytest.importorskip("pandas")

0 commit comments

Comments
 (0)