Skip to content

Commit 5da91ca

Browse files
authored
Merge pull request #219 from kayjan/fix-nan-check
Fix nan check
2 parents 1269263 + d54b1df commit 5da91ca

File tree

6 files changed

+12
-9
lines changed

6 files changed

+12
-9
lines changed

CHANGELOG.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [0.16.4] - 2024-03-14
10+
### Fixed
11+
- [#216] Tree Exporter: Fix nan checker when printing trees.
12+
913
## [0.16.3] - 2024-03-14
1014
### Added
1115
- BaseNode: Add diameter property.
@@ -507,7 +511,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
507511
- Utility Iterator: Tree traversal methods.
508512
- Workflow To Do App: Tree use case with to-do list implementation.
509513

510-
[Unreleased]: https://github.com/kayjan/bigtree/compare/0.16.3...HEAD
514+
[Unreleased]: https://github.com/kayjan/bigtree/compare/0.16.4...HEAD
515+
[0.16.4]: https://github.com/kayjan/bigtree/compare/0.16.3...0.16.4
511516
[0.16.3]: https://github.com/kayjan/bigtree/compare/0.16.2...0.16.3
512517
[0.16.2]: https://github.com/kayjan/bigtree/compare/0.16.1...0.16.2
513518
[0.16.1]: https://github.com/kayjan/bigtree/compare/0.16.0...0.16.1

bigtree/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "0.16.3"
1+
__version__ = "0.16.4"
22

33
from bigtree.binarytree.construct import list_to_binarytree
44
from bigtree.dag.construct import dataframe_to_dag, dict_to_dag, list_to_dag

bigtree/tree/export.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def _isnull(value: Any) -> bool:
6060
Returns:
6161
(bool)
6262
"""
63-
if not value or math.isnan(value):
63+
if not value or (isinstance(value, float) and math.isnan(value)):
6464
return True
6565
return False
6666

docs/contributing.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,7 @@ When creating branches, it is recommended to create them in the format `type/act
8383
$ git checkout -b feat/add-this
8484
```
8585

86-
When performing commits, it is also recommended to follow [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) when writing commit messages.
87-
88-
During pre-commit checks, this project checks and formats code using `black`, `flake8`, `isort`, and `mypy`.
86+
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`.
8987

9088
For testing, this project uses `pytest` and `coverage` package for testing of codes, and `docstr-coverage` and `doctest` package for testing of docstrings.
9189

tests/tree/conftest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def tree_node_negative_null_attr():
9494
d = Node("d", age=1)
9595
e = Node("e", age=None)
9696
f = Node("f", age=float("nan"))
97-
g = Node("g")
97+
g = Node("g", age="10")
9898
h = Node("h")
9999

100100
b.parent = a

tests/tree/test_export.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def test_print_tree_attr_omit_null_false(tree_node_negative_null_attr):
9797
"├── b [age=-1]\n"
9898
"│ ├── d [age=1]\n"
9999
"│ └── e [age=None]\n"
100-
"│ ├── g\n"
100+
"│ ├── g [age=10]\n"
101101
"│ └── h\n"
102102
"└── c [age=0]\n"
103103
" └── f [age=nan]\n"
@@ -117,7 +117,7 @@ def test_print_tree_attr_omit_null_true(tree_node_negative_null_attr):
117117
"├── b [age=-1]\n"
118118
"│ ├── d [age=1]\n"
119119
"│ └── e\n"
120-
"│ ├── g\n"
120+
"│ ├── g [age=10]\n"
121121
"│ └── h\n"
122122
"└── c\n"
123123
" └── f\n"

0 commit comments

Comments
 (0)