TestCounting.test_count_by()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
dl 0
loc 7
rs 9.4285
1
import unittest
0 ignored issues
show
Coding Style introduced by
This module should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
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