Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7k
Provide tests for hashing ofOperandHolder
#9437
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
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.
thanks for the followup contribution!
1e9b5c1
intoencode:masterUh oh!
There was an error while loading.Please reload this page.
@@ -716,3 +716,59 @@ def has_object_permission(self, request, view, obj): | |||
composed_perm = (IsAuthenticatedUserOwner | permissions.IsAdminUser) | |||
hasperm = composed_perm().has_object_permission(request, None, None) | |||
assert hasperm is False | |||
def test_operand_holder_is_hashable(self): | |||
assert hash((permissions.IsAuthenticated & permissions.IsAdminUser)) |
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.
May fail ifhash
returns zero. The proper check would be that no exception is thrown. (E.g., via>= 0
)
filtered_permissions = [ | ||
perm for perm | ||
in dict.fromkeys(unfiltered_permissions) | ||
] |
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.
filtered_permissions = list(dict.fromkeys(unfiltered_permissions))
@peterthomassen Should I open PR for these fixes? |
I don't think so; just trying to enable the community to learn from each other! :-) Thanks for the tests, I like how they are set up. |
Description
Provide tests for#9417 according tocomment