-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from raisadz/increase-coverage
Increase coverage for narwhals.dataframe
- Loading branch information
Showing
2 changed files
with
71 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
from __future__ import annotations | ||
|
||
from typing import Any | ||
|
||
|
||
def compare_dicts(result: dict[str, Any], expected: dict[str, Any]) -> None: | ||
for key in expected: | ||
for lhs, rhs in zip(result[key], expected[key]): | ||
if isinstance(lhs, float): | ||
assert abs(lhs - rhs) < 1e-6 | ||
else: | ||
assert lhs == rhs | ||
from __future__ import annotations | ||
|
||
from typing import Any | ||
|
||
import polars as pl | ||
|
||
|
||
def compare_dicts(result: dict[str, Any], expected: dict[str, Any]) -> None: | ||
if isinstance(result, pl.LazyFrame): | ||
result = result.collect() | ||
for key in expected: | ||
for lhs, rhs in zip(result[key], expected[key]): | ||
if isinstance(lhs, float): | ||
assert abs(lhs - rhs) < 1e-6 | ||
else: | ||
assert lhs == rhs |