Skip to content

Commit e9ac904

Browse files
authored
Merge pull request #321 from kayjan/feature/new-polars
Fix unit test to work with new polars
2 parents d0dfa7c + 7eab9c3 commit e9ac904

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515
- Misc: Documentation to include tips and tricks on working with custom classes.
1616
- Tree Export: Mermaid diagram title to add newline.
1717
- Tree Helper: Get tree diff string replacement bug when the path change is substring of another path.
18+
- Tree Export: Polars test to work with old (<=1.9.0) and new polars version.
1819

1920
## [0.22.1] - 2024-11-03
2021
### Added:

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ path = "bigtree/__init__.py"
5858
dependencies = [
5959
"black",
6060
"coverage",
61+
"isort",
6162
"matplotlib",
6263
"mypy",
6364
"pandas",

tests/tree/test_export.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,11 +1173,20 @@ def test_tree_to_polars_name_col_missing(tree_node):
11731173
tuple(map(int, pl.__version__.split(".")[:2])) > (1, 9),
11741174
reason="Not compatible with polars>1.9.0",
11751175
)
1176+
def test_tree_to_polars_name_path_col_missing_old_polars(tree_node):
1177+
actual = export.tree_to_polars(tree_node, name_col="", path_col="")
1178+
assert actual.is_empty()
1179+
assert actual.shape == (0, 0)
1180+
1181+
@staticmethod
1182+
@unittest.skipIf(
1183+
tuple(map(int, pl.__version__.split(".")[:2])) <= (1, 9),
1184+
reason="Not compatible with polars<=1.9.0",
1185+
)
11761186
def test_tree_to_polars_name_path_col_missing(tree_node):
1177-
expected = pl.DataFrame()
1178-
expected.index = range(8)
11791187
actual = export.tree_to_polars(tree_node, name_col="", path_col="")
1180-
assert expected.equals(actual)
1188+
assert actual.is_empty()
1189+
assert actual.shape == (8, 0)
11811190

11821191
@staticmethod
11831192
def test_tree_to_polars_parent_col(tree_node):

0 commit comments

Comments
 (0)