Skip to content

v0.1.0

Latest
Compare
Choose a tag to compare
@nick-at-dave nick-at-dave released this 03 Aug 00:47
· 2 commits to main since this release

This release handles the case of getting a node that does not yet exist. Does so by returning a temporary node that can then be passed down the chain to a get which will then fail and remove the temporary node.

Tests

Since I hate tests, I'll just show the behavior that has been tested to work:

>>> from dotdict import DotDict as dd
>>> test = dd()
>>> test.a.b = 1
>>> test.a.c
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/.../dotdict.py", line 24, in __getattr__
    raise AttributeError("No attribute '%s'" % __name)
AttributeError: No attribute 'c'

TODO

This only really kicks the can down the road. Now any intermediate nodes are considered "temp".