Skip to content

Commit f3b1bb6

Browse files
committed
Add extra test for required=False
1 parent 02b22bd commit f3b1bb6

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

tests/test_hstore_required.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def test_rename_field():
126126
assert len(calls.get('DROP CONSTRAINT', [])) == 0
127127

128128

129-
def test_enforcement():
129+
def test_required_enforcement():
130130
"""Tests whether the constraints are actually
131131
properly enforced."""
132132

@@ -136,3 +136,14 @@ def test_enforcement():
136136

137137
with pytest.raises(IntegrityError):
138138
model.objects.create(title={'ar': 'hello'})
139+
140+
141+
def test_no_required():
142+
"""Tests whether setting `required` to False casues
143+
no requiredness constraints to be added."""
144+
145+
model = get_fake_model({
146+
'title': HStoreField(required=False)
147+
})
148+
149+
model.objects.create(title={'ar': 'hello'})

0 commit comments

Comments
 (0)