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
Adding instruction to "helper.literal_eval_extended" for comparing custom object #317
Comments
Any comments or suggestions on the above? That would extremely help for my current project! |
Hi @atah1991 Hence right now the eval is limited to very few things in the list you have posted (LITERAL_EVAL_PRE_PROCESS) other than what Python's restricted eval ( The problem is not specific to the data classes. If you even remove the data class decorators, you will still run into this issue when your keys are custom objects. Maybe in the future we can add a flag to allow |
Hi, @atah1991 , did you find any workaround for this? My use case has modifying helper.py as problematic. I was getting the same warning for classes deriving from enum.Enum. I seem to be able to work around the issue by setting a repr for the class, returning
So it displays as
|
We do allow a "safe" list for Delta objects. We can use the same logic to allow eval to be run on paths too. |
Hi! Thanks for this great lib! I happened to get a bug on a custom case when I compare dictionaries where key is the dataclass(simplified example below). The output of the DeepDiff shows the path to fields as None.
The script above outputs to
After surfacing the code, I understand that so far support is for the following cases in helper:
Is there a way for the user to add the custom instruction to this list and pass it in DeepDiff interface so the resulted diff shows the path (not None) to fields that are different? Or maybe there is a better way to have comparison for such objects? Note, I would like to compare them as dictionaries, instead of iterating over keys, values and comparing them
Thanks!
The text was updated successfully, but these errors were encountered: