Skip to content

Commit

Permalink
Merge pull request #321 from kayjan/feature/new-polars
Browse files Browse the repository at this point in the history
Fix unit test to work with new polars
  • Loading branch information
kayjan authored Nov 5, 2024
2 parents d0dfa7c + 7eab9c3 commit e9ac904
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Misc: Documentation to include tips and tricks on working with custom classes.
- Tree Export: Mermaid diagram title to add newline.
- Tree Helper: Get tree diff string replacement bug when the path change is substring of another path.
- Tree Export: Polars test to work with old (<=1.9.0) and new polars version.

## [0.22.1] - 2024-11-03
### Added:
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ path = "bigtree/__init__.py"
dependencies = [
"black",
"coverage",
"isort",
"matplotlib",
"mypy",
"pandas",
Expand Down
15 changes: 12 additions & 3 deletions tests/tree/test_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -1173,11 +1173,20 @@ def test_tree_to_polars_name_col_missing(tree_node):
tuple(map(int, pl.__version__.split(".")[:2])) > (1, 9),
reason="Not compatible with polars>1.9.0",
)
def test_tree_to_polars_name_path_col_missing_old_polars(tree_node):
actual = export.tree_to_polars(tree_node, name_col="", path_col="")
assert actual.is_empty()
assert actual.shape == (0, 0)

@staticmethod
@unittest.skipIf(
tuple(map(int, pl.__version__.split(".")[:2])) <= (1, 9),
reason="Not compatible with polars<=1.9.0",
)
def test_tree_to_polars_name_path_col_missing(tree_node):
expected = pl.DataFrame()
expected.index = range(8)
actual = export.tree_to_polars(tree_node, name_col="", path_col="")
assert expected.equals(actual)
assert actual.is_empty()
assert actual.shape == (8, 0)

@staticmethod
def test_tree_to_polars_parent_col(tree_node):
Expand Down

0 comments on commit e9ac904

Please sign in to comment.