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

BUG: Replaced default parameter [] by None and made some simplifications #9

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

che85
Copy link

@che85 che85 commented Oct 20, 2016

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)

@@ -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
Copy link
Author

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"

che85 added a commit to che85/dcmqi that referenced this pull request Oct 20, 2016
- added missing attributes
- fixed json comparison script (for the reference ChannelIQ/jsoncompare#8 and ChannelIQ/jsoncompare#9)
@dandroid88
Copy link
Contributor

dandroid88 commented Oct 20, 2016

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.

@che85 che85 changed the title BUG: For preventing unexpected behavior while executing are_same, con… BUG: Replaced default parameter [] by None and made some simplifications Oct 21, 2016
@fedorov
Copy link

fedorov commented Oct 21, 2016

@dandroid88 I think keeping it under your account is a good idea, and also adding a note in the README about the new location.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants