Skip to content

Commit

Permalink
Add unit test for invalid lookup fields
Browse files Browse the repository at this point in the history
  • Loading branch information
onyb committed Oct 3, 2017
1 parent a709cec commit e6d6f41
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/unit/test_Q.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,4 @@ def test_nested_istartswith(self):
def test_nested_dict_istartswith(self):
q_obj = Q(secret__gem__istartswith='RUB')
obj = SecretModel(secret={'gem': 'ruby'})
self.assertTrue(q_obj.comparator(obj))
self.assertTrue(q_obj.comparator(obj))
7 changes: 7 additions & 0 deletions tests/unit/test_queryset.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,13 @@ def test_values_list(self):
)
)

def test_invalid_lookup_params(self):
SomeModel(p='foo', q=1)
SomeModel(p='bar', q=2)

with self.assertRaises(TypeError):
SomeModel.objects.all().values_list('p', 0)

def test_values_list_flat(self):
SomeModel(p='foo', q=1)
SomeModel(p='bar', q=2)
Expand Down

0 comments on commit e6d6f41

Please sign in to comment.