File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff 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 ()
You can’t perform that action at this time.
0 commit comments