| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -328,14 +328,14 @@ def __ior__(self, other): | |
| return self | ||
|
|
||
| def __or__(self, other): | ||
| if not isinstance(other, dict): | ||
| if not isinstance(other, (dict, frozendict)): | ||
| return NotImplemented | ||
| new = self.__class__(self) | ||
| new.update(other) | ||
| return new | ||
|
|
||
| def __ror__(self, other): | ||
| if not isinstance(other, dict): | ||
| if not isinstance(other, (dict, frozendict)): | ||
| return NotImplemented | ||
| new = self.__class__(other) | ||
| new.update(self) | ||
| Expand Down Expand Up | @@ -1221,14 +1221,14 @@ def __repr__(self): | |
| def __or__(self, other): | ||
| if isinstance(other, UserDict): | ||
| return self.__class__(self.data | other.data) | ||
| if isinstance(other, dict): | ||
| if isinstance(other, (dict, frozendict)): | ||
|
Comment thread
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityAny tests for this?
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityNo, I didn't see where the dict version was tested so left this alone.
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityVery bad. We need to add tests with dict first.
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityWell, let's leave this. There are many other missing tests for UserDict and UserList. I am working on this.
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality#145145 will add new tests. Now there will be a place for new frozendict tests.
Sorry, something went wrong.
All reactions
|
||
| return self.__class__(self.data | other) | ||
| return NotImplemented | ||
|
|
||
| def __ror__(self, other): | ||
| if isinstance(other, UserDict): | ||
| return self.__class__(other.data | self.data) | ||
| if isinstance(other, dict): | ||
| if isinstance(other, (dict, frozendict)): | ||
| return self.__class__(other | self.data) | ||
| return NotImplemented | ||
|
|
||
| Expand Down | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -698,6 +698,7 @@ def test_merge_operator(self): | |
| d |= list(b.items()) | ||
| expected = OrderedDict({0: 0, 1: 1, 2: 2, 3: 3}) | ||
| self.assertEqual(a | dict(b), expected) | ||
| self.assertEqual(a | frozendict(b), expected) | ||
|
Comment thread
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityShould not the type of the result to be tested too?
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityThe existing test didn't check result type. I don't want to feature creep this edit. Reviewing and expanding the existing test strategies can be a task for another day.
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityThe new tests are passed with unmodified code. Therefore they are not correct tests for this change.
Sorry, something went wrong.
All reactions
|
||
| self.assertEqual(a | b, expected) | ||
| self.assertEqual(c, expected) | ||
| self.assertEqual(d, expected) | ||
| Expand All | @@ -706,6 +707,7 @@ def test_merge_operator(self): | |
| c |= a | ||
| expected = OrderedDict({1: 1, 2: 1, 3: 3, 0: 0}) | ||
| self.assertEqual(dict(b) | a, expected) | ||
| self.assertEqual(frozendict(b) | a, expected) | ||
| self.assertEqual(b | a, expected) | ||
| self.assertEqual(c, expected) | ||
|
|
||
| Expand Down | ||
| Back | FazBrowse Home | New Git URL |
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityWhat about the C implementation?
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityThe C version already supported any mapping input, that is how the tests passed. But I will update the fast path to use PyAnyDict_CheckExact(arg).
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.