Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change of behavior from 0.16.0 to 0.17.0 #8

Closed
rbentaarit opened this issue Feb 7, 2020 · 3 comments
Closed

Change of behavior from 0.16.0 to 0.17.0 #8

rbentaarit opened this issue Feb 7, 2020 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@rbentaarit
Copy link

Python version
3.7.5

Package version
0.17.0

Current behavior (bug description)

d = benedict({'jobs': [{'name': 'job-name', 'plan': [{'put': 'put-name', 'params': {'action': 'create', 'fields': {'Version/s': [{'name': 'N/A'}], 'User Impact': 'Info on User Impacts'}}}]}]}, keypath_separator='/')
outputs :

On 0.16.0
{'jobs': [{'name': 'job-name', 'plan': [{'put': 'put-name', 'params': {'action': 'create', 'fields': {'Version/s': [{'name': 'N/A'}], 'User Impact': 'Info on User Impacts'}}}]}]}

On 0.17.0
File "/usr/local/lib/python3.7/site-packages/benedict/dicts/keypath/keypath_util.py", line 23, in check_key
''{}', found: '{}'.'.format(separator, key))
ValueError: keys should not contain keypath separator '/', found: 'Version/s'.

Expected behavior
We saw this error while running our unit tests.
I didn't see a specific bugfix, I suppose that 0.17.0 is the correct behavior?
Can you please confirm it?

@rbentaarit rbentaarit added the bug Something isn't working label Feb 7, 2020
@fabiocaccamo
Copy link
Owner

fabiocaccamo commented Feb 7, 2020

Yes 0.17.0 is the correct behavior.
As you can see the exception is raised because a dict key contain the keypath separator.

This was not a bugfix, but an enforcement... btw maybe I forgot to add this change to the changelog, sorry.

I hope you find this lib useful and you recommend it to other devs. Any feedback or feature request will be appreciated.

@rbentaarit
Copy link
Author

We do really love this library.
Thank you !

@fabiocaccamo
Copy link
Owner

@rbentaarit if your dict keys contain the keypath_separator you can initialize the dict with keypath_separator=None, call standardize, then you can set keypath_separator to the char you need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants