kayjan / bigtree

Tree Implementation and Methods for Python, integrated with list, dictionary, pandas and polars DataFrame.

Home Page:https://bigtree.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Constructing a tree with 'dict_to_tree' does not set attributes to Node attributes

sveetch opened this issue · comments

Describe the issue
A clear and concise description of what the bug is.

If you got an exception related to the bug, you must paste it here (the full traceback).

Environment
Describe your environment:

  • Plateform: Ubuntu
  • Python version: 3.8
  • bigtree version: 0.10.2

To Reproduce
Steps to reproduce the behavior:

  1. Make a custom Node object as from sample: https://bigtree.readthedocs.io/en/latest/others/tips.html#population-node-add-functionality-method-property
  2. Construct a tree from a dict as from sample: https://bigtree.readthedocs.io/en/latest/bigtree/tree/construct.html#bigtree.tree.construct.dict_to_tree
  3. Set 'node_type' to the custom Node
  4. Try to export created tree to a dict with 'tree_to_nested_dict'
  5. Resulting dictionnary have attributes set to argument default value

Expected behavior
I was trying to load a list of paths to build a tree, using 'dict_to_tree' to carry extra path informations and then export it to a nested dictionnary structure with its attributes.

For my research i did a test suite file with pytest which demonstrate behavior and expections: https://gist.github.com/sveetch/7d60f0cfcc76ae31f2ca973038da3c88

Hi, thanks for raising this issue! The fix is implemented in v0.10.3, do upgrade bigtree with the command pip install --upgrade bigtree.

Wow that was quick, thanks for your responsiveness you're wonderful 👍👍👍