added a new function: get_value_in_nested_dict#31
Conversation
|
Hi Deniz, since you are writing manual tests, I would suggest instead to start slowly incorporating those into a unit test suite, which can run automatically whenever someone changes the parser. |
|
@denizural , I put together this function some time ago to search for the key word |
|
@pgierz, I totally agree with you. I think we need more test driven development in the project for less headaches 😄. Python already provides unit testing frameworks. I will have a look at these. @mandresm, thank you very much for the explanation. I another branch that I am currently working, I needed this functionality and decided to search the parser if we already have something to avoid duplicate code. |
|
Sure :) I also need this functionality for the environment rework, in fact I coded something simpler for nested keys, but your solution is better and more general so I will switch to yours as soon as it is available in About |
|
@denizural , so this is the little function I put together to use the paths provided by Let me know if you think it worths to include this functionality here so that this function is also compatible with |
I just found out that there was an already existing method for this purpose on |
I added this functionality to get the list of values from a dictionary for a given key. There is already a function called
find_keybut it does not do what I want it to do and even more, I think there a some odd behaviour in that function. Look at this test:then the result is
The previous function (
find_key) even matches mpifc. Is this the expected behaviour? I think theinoperator is causing the trouble here. I think==operator should be use to compare the strings.In any case I think this new function will be useful for the future cases.