MCPcopy Create free account
hub / github.com/MongoEngine/mongoengine / test_save_none

Method test_save_none

tests/fields/test_decimal_field.py:62–74  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

60 assert expected == actual
61
62 def test_save_none(self):
63 class Person(Document):
64 value = DecimalField()
65
66 Person.drop_collection()
67
68 person = Person(value=None)
69 assert person.value is None
70 person.save()
71 fetched_person = Person.objects.first()
72 fetched_person.value is None
73
74 assert Person.objects(value=None).first() is not None
75
76 def test_validation(self):
77 """Ensure that invalid values cannot be assigned to decimal fields."""

Callers

nothing calls this directly

Calls 5

drop_collectionMethod · 0.80
PersonClass · 0.70
saveMethod · 0.45
firstMethod · 0.45
objectsMethod · 0.45

Tested by

no test coverage detected