Completed
Push — master ( 237e65...e0f5de )
by Philip
26s
created

TestCounting   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A test_count_by() 0 7 1
1
import unittest
2
3
from foil.counting import count_by
4
5
6
class TestCounting(unittest.TestCase):
7
    def test_count_by(self):
8
        field_name = 'field'
9
        records = [{field_name: 'a'}, {field_name: 'b'}, {field_name: 'a'}]
10
11
        expected = {'a': 2, 'b': 1}
12
        result = count_by(records, field_name)
13
        self.assertDictEqual(expected, result)
14