Esempio n. 1
0
 def testSumByString(self):
     seq = (1, 2, 3, 4, 5, 6)
     tags = ('a', 'b', 'a', 'c', 'b', 'a')
     expected = {'a': 1 + 3 + 6, 'b': 2 + 5, 'c': 4}
     res = rlf.tapply(seq, tags, sum)
     for k, v in res:
         self.assertEqual(expected[k], v)
Esempio n. 2
0
def test_tapply_sumbystring():
    seq = (1, 2, 3, 4, 5, 6)
    tags = ('a', 'b', 'a', 'c', 'b', 'a')
    expected = {'a': 1 + 3 + 6, 'b': 2 + 5, 'c': 4}
    res = rlf.tapply(seq, tags, sum)
    for k, v in res:
        assert expected[k] == v
Esempio n. 3
0
 def testSumByString(self):
     seq  = (  1,   2,   3,   4,   5,   6)
     tags = ('a', 'b', 'a', 'c', 'b', 'a')
     expected = {'a': 1+3+6,
                 'b': 2+5,
                 'c': 4}
     res = rlf.tapply(seq, tags, sum)
     for k, v in res:
         self.assertEqual(expected[k], v)