MCPcopy Index your code
hub / github.com/MongoEngine/mongoengine / test_array_sum

Method test_array_sum

tests/queryset/test_queryset.py:3642–3653  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3640 assert Doc.objects.sum("pay.values") == 1360
3641
3642 def test_array_sum(self):
3643 class Doc(Document):
3644 values = ListField(DecimalField())
3645
3646 Doc.drop_collection()
3647
3648 Doc(values=[150, 100]).save()
3649 Doc(values=[530, 100]).save()
3650 Doc(values=[165, 100]).save()
3651 Doc(values=[115, 100]).save()
3652
3653 assert Doc.objects.sum("values") == 1360
3654
3655 def test_distinct(self):
3656 """Ensure that the QuerySet.distinct method works."""

Callers

nothing calls this directly

Calls 4

drop_collectionMethod · 0.80
sumMethod · 0.80
DocClass · 0.70
saveMethod · 0.45

Tested by

no test coverage detected