def test_summing_by_different_column(self):
     assert_equal(
         _sum_counts([
             {'count': 1, 'new_count': 10},
             {'count': 2, 'new_count': 20},
             {'count': 3, 'new_count': 30},
             {'count': 4, 'new_count': 40}
         ], sum_by='new_count'),
         100
     )
 def test_summing_without_filtering(self):
     assert_equal(
         _sum_counts([
             {'count': 1},
             {'count': 2},
             {'count': 3},
             {'count': 4}
         ]),
         10
     )
Exemplo n.º 3
0
 def test_summing_without_filtering(self):
     assert_equal(
         _sum_counts([{
             'count': 1
         }, {
             'count': 2
         }, {
             'count': 3
         }, {
             'count': 4
         }]), 10)
 def test_summing_filtering_on_various_acceptable_attributes(self):
     assert_equal(
         _sum_counts([
             {'count': 1, 'colour': 'cyan'},
             {'count': 2, 'colour': 'yellow'},
             {'count': 3, 'colour': 'magenta'},
             {'count': 4, 'colour': 'black'}
         ], {
             'colour': ['cyan', 'yellow', 'magenta']
         }),
         6
     )
 def test_summing_filtering_on_one_attribute(self):
     assert_equal(
         _sum_counts([
             {'count': 1, 'include': False},
             {'count': 2, 'include': True},
             {'count': 3, 'include': True},
             {'count': 4, 'include': False}
         ], {
             'include': True
         }),
         5
     )
Exemplo n.º 6
0
 def test_summing_filtering_on_various_acceptable_attributes(self):
     assert_equal(
         _sum_counts([{
             'count': 1,
             'colour': 'cyan'
         }, {
             'count': 2,
             'colour': 'yellow'
         }, {
             'count': 3,
             'colour': 'magenta'
         }, {
             'count': 4,
             'colour': 'black'
         }], {'colour': ['cyan', 'yellow', 'magenta']}), 6)
Exemplo n.º 7
0
 def test_summing_filtering_on_one_attribute(self):
     assert_equal(
         _sum_counts([{
             'count': 1,
             'include': False
         }, {
             'count': 2,
             'include': True
         }, {
             'count': 3,
             'include': True
         }, {
             'count': 4,
             'include': False
         }], {'include': True}), 5)
Exemplo n.º 8
0
 def test_summing_by_different_column(self):
     assert_equal(
         _sum_counts([{
             'count': 1,
             'new_count': 10
         }, {
             'count': 2,
             'new_count': 20
         }, {
             'count': 3,
             'new_count': 30
         }, {
             'count': 4,
             'new_count': 40
         }],
                     sum_by='new_count'), 100)