Esempio n. 1
0
def test_countby():
    assert countby(iseven, [1, 2, 3]) == {True: 1, False: 2}
    assert countby(len, ['cat', 'dog', 'mouse']) == {3: 2, 5: 1}
    assert countby(0, ('ab', 'ac', 'bc')) == {'a': 2, 'b': 1}
    assert countby([0], ('ab', 'ac', 'bc')) == {('a',): 2, ('b',): 1}
    assert countby([0, 0], ('ab', 'ac', 'bc')) == {('a', 'a'): 2, ('b', 'b'): 1}
Esempio n. 2
0
def test_countby():
    assert countby(iseven, [1, 2, 3]) == {True: 1, False: 2}
    assert countby(len, ['cat', 'dog', 'mouse']) == {3: 2, 5: 1}
Esempio n. 3
0
def test_countby():
    assert countby(iseven, [1, 2, 3]) == {True: 1, False: 2}
    assert countby(len, ['cat', 'dog', 'mouse']) == {3: 2, 5: 1}
def test_countby():
    assert countby(iseven, [1, 2, 3]) == {True: 1, False: 2}
    assert countby(len, ["cat", "dog", "mouse"]) == {3: 2, 5: 1}
    assert countby(0, ("ab", "ac", "bc")) == {"a": 2, "b": 1}
Esempio n. 5
0
 def count_by(self, key=cytoolz.functoolz.identity):
     return fdict(cytoolz.countby(key, self))
Esempio n. 6
0
def test_countby():
    assert countby(iseven, [1, 2, 3]) == {True: 1, False: 2}
    assert countby(len, ['cat', 'dog', 'mouse']) == {3: 2, 5: 1}
    assert countby(0, ('ab', 'ac', 'bc')) == {'a': 2, 'b': 1}