Ensure required cant be None / Empty.
(self)
| 1066 | e.save() |
| 1067 | |
| 1068 | def test_complex_field_required(self): |
| 1069 | """Ensure required cant be None / Empty.""" |
| 1070 | |
| 1071 | class Simple(Document): |
| 1072 | mapping = ListField(required=True) |
| 1073 | |
| 1074 | Simple.drop_collection() |
| 1075 | |
| 1076 | e = Simple() |
| 1077 | e.mapping = [] |
| 1078 | with pytest.raises(ValidationError): |
| 1079 | e.save() |
| 1080 | |
| 1081 | class Simple(Document): |
| 1082 | mapping = DictField(required=True) |
| 1083 | |
| 1084 | Simple.drop_collection() |
| 1085 | e = Simple() |
| 1086 | e.mapping = {} |
| 1087 | with pytest.raises(ValidationError): |
| 1088 | e.save() |
| 1089 | |
| 1090 | def test_complex_field_same_value_not_changed(self): |
| 1091 | """If a complex field is set to the same value, it should not |
nothing calls this directly
no test coverage detected