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

Method test_array_average

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

Source from the content-addressed store, hash-verified

3593 assert Doc.objects.average("pay.values") == 170
3594
3595 def test_array_average(self):
3596 class Doc(Document):
3597 values = ListField(DecimalField())
3598
3599 Doc.drop_collection()
3600
3601 Doc(values=[150, 100]).save()
3602 Doc(values=[530, 100]).save()
3603 Doc(values=[165, 100]).save()
3604 Doc(values=[115, 100]).save()
3605
3606 assert Doc.objects.average("values") == 170
3607
3608 def test_embedded_sum(self):
3609 class Pay(EmbeddedDocument):

Callers

nothing calls this directly

Calls 4

drop_collectionMethod · 0.80
averageMethod · 0.80
DocClass · 0.70
saveMethod · 0.45

Tested by

no test coverage detected