-
Notifications
You must be signed in to change notification settings - Fork 41
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
BUG: Replaced default parameter [] by None and made some simplifications #9
base: master
Are you sure you want to change the base?
Conversation
…tains or json_are_same several times, setting lists to None instead of [] for reference see http://docs.python-guide.org/en/latest/writing/gotchas/#mutable-default-arguments
@@ -94,6 +95,7 @@ def _bottom_up_sort(unsorted_json): | |||
else: | |||
return unsorted_json | |||
|
|||
|
|||
def _are_same(expected, actual, ignore_value_of_keys, ignore_missing_keys=False): | |||
# Check for None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you might want to add something like "allowAdditionalKeys"
- added missing attributes - fixed json comparison script (for the reference ChannelIQ/jsoncompare#8 and ChannelIQ/jsoncompare#9)
Hi Christian, I am the original author but now work at a new company (my own, https://flair.co !) and was wondering if it makes sense to fork this under a non-corporate account? Happy to fork it over to mine or something or leave it as is but I think ChannelIQ was acquired and I have no idea who is in charge of the account anymore. Anyhow, not sure of best practice but open to ideas and suggestions! I had fun writing this code and use it on some of our stuff so happy to continue contributing. |
@dandroid88 I think keeping it under your account is a good idea, and also adding a note in the README about the new location. |
Unexpected behavior might have occurred while running json_are_same several times in a row with different lists.
When using [] as the default value of a list and you run it several times, then the list might look different as you expected it to look like. (see here http://docs.python-guide.org/en/latest/writing/gotchas/#mutable-default-arguments)