Skip to content

Commit 0fb1e28

Browse files
committed
Split test cases
1 parent 87f842a commit 0fb1e28

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

tests/test_isnull.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,19 @@ def test_isnull_lookup_valid_values(self):
3333
assert self.TestModel.objects.filter(text__isnull=True).exists()
3434
assert self.TestModel.objects.filter(text__isnull=False).exists()
3535

36-
def test_isnull_lookup_invalid_values(self):
37-
"""Test whether isnull crashes with invalid values."""
36+
def test_isnull_lookup_null(self):
37+
"""Test whether isnull crashes with None as value."""
38+
3839
with pytest.raises(ValueError):
3940
assert self.TestModel.objects.filter(text__isnull=None).exists()
4041

41-
with pytest.raises(ValueError):
42+
def test_isnull_lookup_string(self):
43+
"""Test whether isnull properly works with string values on the
44+
corresponding Django version."""
45+
if django.VERSION < (4, 0):
4246
assert self.TestModel.objects.filter(text__isnull="True").exists()
47+
else:
48+
with pytest.raises(ValueError):
49+
assert self.TestModel.objects.filter(
50+
text__isnull="True"
51+
).exists()

0 commit comments

Comments
 (0)