-
Notifications
You must be signed in to change notification settings - Fork 88
Conversation
Python3 support
updated test to python3
@@ -14,29 +17,35 @@ def __call__(self): | |||
|
|||
def prepare_queryset_kwargs(self, field, value, negate): | |||
if negate: | |||
return {'__'.join(filter(None, [field, 'not', self.op])): value} | |||
return {'__'.join([_f for _f in [field, 'not', self.op] if _f]): value} |
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.
filter
still exists in Python 3.5.2, why change? https://docs.python.org/3/library/functions.html#filter
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.
I used 2to3 library, the library converts this specific implementation of filters.
self.assertEqual(errors['field-errors'].keys(), ['emails']) | ||
self.assertEqual(errors['field-errors']['emails']['errors'].keys(), ['1', '3']) | ||
self.assertEqual(list(errors['field-errors'].keys()), ['emails']) | ||
self.assertCountEqual(list(errors['field-errors']['emails']['errors'].keys()), ['3', '1']) |
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.
Good catch, keep in mind that assertCountEqual
was only added in Python 3.2 and therefore would break Python 2.7 compatibility. I'll fix this by simply doing a set()
comparison.
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.
okay!
@saurabh1e Thanks for this. I prepared #99 based on this. Let me know if anything is missing there. |
No description provided.