From 3b944e4059e46e9632a2a46ceedaffa2dec38794 Mon Sep 17 00:00:00 2001 From: Kay Date: Tue, 5 Nov 2024 22:47:23 +0800 Subject: [PATCH 1/3] fix: install isort in default env --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index a48504ca..dd1b70ae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,6 +58,7 @@ path = "bigtree/__init__.py" dependencies = [ "black", "coverage", + "isort", "matplotlib", "mypy", "pandas", From b55a89fdd8c71c4f554cb7271acb79e07cb0da90 Mon Sep 17 00:00:00 2001 From: Kay Date: Tue, 5 Nov 2024 23:16:19 +0800 Subject: [PATCH 2/3] test: fix polars test to work with old and new polars --- tests/tree/test_export.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/tree/test_export.py b/tests/tree/test_export.py index 553c2237..4886160c 100644 --- a/tests/tree/test_export.py +++ b/tests/tree/test_export.py @@ -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): From 7eab9c308a1501ed410d92587d01806e3c1f9078 Mon Sep 17 00:00:00 2001 From: Kay Date: Tue, 5 Nov 2024 23:16:59 +0800 Subject: [PATCH 3/3] test: fix polars test to work with old and new polars --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d58d26f7..2a784e33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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: