Skip to content
This repository has been archived by the owner on Jan 23, 2024. It is now read-only.

Python3 support #95

Closed
wants to merge 23 commits into from
Closed

Conversation

saurabh1e
Copy link

No description provided.

@@ -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}
Copy link
Member

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

Copy link
Author

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'])
Copy link
Member

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay!

thomasst added a commit that referenced this pull request Sep 26, 2016
@thomasst thomasst mentioned this pull request Sep 26, 2016
@thomasst
Copy link
Member

@saurabh1e Thanks for this. I prepared #99 based on this. Let me know if anything is missing there.

@thomasst thomasst closed this Sep 28, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants