Skip to content

Commit

Permalink
Merge pull request #219 from kayjan/fix-nan-check
Browse files Browse the repository at this point in the history
Fix nan check
  • Loading branch information
kayjan authored Mar 14, 2024
2 parents 1269263 + d54b1df commit 5da91ca
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 9 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion bigtree/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion bigtree/tree/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 1 addition & 3 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion tests/tree/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/tree/test_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down

0 comments on commit 5da91ca

Please sign in to comment.