diff --git a/CHANGELOG.md b/CHANGELOG.md index f53a6543..b5f5ad4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.16.4] - 2024-03-14 +### Fixed +- [#216] Tree Exporter: Fix nan checker when printing trees. + ## [0.16.3] - 2024-03-14 ### Added - BaseNode: Add diameter property. @@ -507,7 +511,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Utility Iterator: Tree traversal methods. - Workflow To Do App: Tree use case with to-do list implementation. -[Unreleased]: https://github.com/kayjan/bigtree/compare/0.16.3...HEAD +[Unreleased]: https://github.com/kayjan/bigtree/compare/0.16.4...HEAD +[0.16.4]: https://github.com/kayjan/bigtree/compare/0.16.3...0.16.4 [0.16.3]: https://github.com/kayjan/bigtree/compare/0.16.2...0.16.3 [0.16.2]: https://github.com/kayjan/bigtree/compare/0.16.1...0.16.2 [0.16.1]: https://github.com/kayjan/bigtree/compare/0.16.0...0.16.1 diff --git a/bigtree/__init__.py b/bigtree/__init__.py index c438f1ea..9960d6bf 100644 --- a/bigtree/__init__.py +++ b/bigtree/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.16.3" +__version__ = "0.16.4" from bigtree.binarytree.construct import list_to_binarytree from bigtree.dag.construct import dataframe_to_dag, dict_to_dag, list_to_dag diff --git a/bigtree/tree/export.py b/bigtree/tree/export.py index 7a281880..21f78c7a 100644 --- a/bigtree/tree/export.py +++ b/bigtree/tree/export.py @@ -60,7 +60,7 @@ def _isnull(value: Any) -> bool: Returns: (bool) """ - if not value or math.isnan(value): + if not value or (isinstance(value, float) and math.isnan(value)): return True return False diff --git a/docs/contributing.md b/docs/contributing.md index 391aa8d7..7a6f563f 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -83,9 +83,7 @@ When creating branches, it is recommended to create them in the format `type/act $ git checkout -b feat/add-this ``` -When performing commits, it is also recommended to follow [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) when writing commit messages. - -During pre-commit checks, this project checks and formats code using `black`, `flake8`, `isort`, and `mypy`. +During pre-commit checks, this project enforces [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) when writing commit messages, and checks and formats code using `black`, `flake8`, `isort`, and `mypy`. For testing, this project uses `pytest` and `coverage` package for testing of codes, and `docstr-coverage` and `doctest` package for testing of docstrings. diff --git a/tests/tree/conftest.py b/tests/tree/conftest.py index fc7b55f2..b78f10df 100644 --- a/tests/tree/conftest.py +++ b/tests/tree/conftest.py @@ -94,7 +94,7 @@ def tree_node_negative_null_attr(): d = Node("d", age=1) e = Node("e", age=None) f = Node("f", age=float("nan")) - g = Node("g") + g = Node("g", age="10") h = Node("h") b.parent = a diff --git a/tests/tree/test_export.py b/tests/tree/test_export.py index 81e08dde..c7556ea2 100644 --- a/tests/tree/test_export.py +++ b/tests/tree/test_export.py @@ -97,7 +97,7 @@ def test_print_tree_attr_omit_null_false(tree_node_negative_null_attr): "├── b [age=-1]\n" "│ ├── d [age=1]\n" "│ └── e [age=None]\n" - "│ ├── g\n" + "│ ├── g [age=10]\n" "│ └── h\n" "└── c [age=0]\n" " └── f [age=nan]\n" @@ -117,7 +117,7 @@ def test_print_tree_attr_omit_null_true(tree_node_negative_null_attr): "├── b [age=-1]\n" "│ ├── d [age=1]\n" "│ └── e\n" - "│ ├── g\n" + "│ ├── g [age=10]\n" "│ └── h\n" "└── c\n" " └── f\n"