1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Removed unnecessary type() calls for class methods.

This commit is contained in:
Jon Dufresne
2019-02-06 19:00:32 -08:00
committed by Tim Graham
parent 80f4ecc647
commit af1434329f
2 changed files with 3 additions and 6 deletions

View File

@@ -234,17 +234,14 @@ class LookupTests(TestCase):
__exact=None is transformed to __isnull=True if a custom lookup class
with lookup_name != 'exact' is registered as the `exact` lookup.
"""
class CustomExactLookup(models.Lookup):
lookup_name = 'somecustomlookup'
field = Author._meta.get_field('birthdate')
OldExactLookup = field.get_lookup('exact')
author = Author.objects.create(name='author', birthdate=None)
try:
type(field).register_lookup(Exactly, 'exact')
field.register_lookup(Exactly, 'exact')
self.assertEqual(Author.objects.get(birthdate__exact=None), author)
finally:
type(field).register_lookup(OldExactLookup, 'exact')
field.register_lookup(OldExactLookup, 'exact')
def test_basic_lookup(self):
a1 = Author.objects.create(name='a1', age=1)