示例#1
0
    def test_three(self):
        obj = Count()
        sel1 = MockEventSelection(name='sel1')
        sel2 = MockEventSelection(name='sel2')
        sel3 = MockEventSelection()
        obj.add(sel1)
        obj.add(sel2)
        obj.add(sel3)

        self.assertEqual([
            [1, 'MockEventSelection', 'sel1', 0, 0],
            [1, 'MockEventSelection', 'sel2', 0, 0],
            [1, 'MockEventSelection', '', 0, 0],
        ], obj._results)

        obj.count(pass_=[True, False])
        self.assertEqual([
            [1, 'MockEventSelection', 'sel1', 1, 1],
            [1, 'MockEventSelection', 'sel2', 0, 1],
            [1, 'MockEventSelection', '', 0, 0],
        ], obj._results)

        obj.count(pass_=[True, True, False])
        self.assertEqual([
            [1, 'MockEventSelection', 'sel1', 2, 2],
            [1, 'MockEventSelection', 'sel2', 1, 2],
            [1, 'MockEventSelection', '', 0, 1],
        ], obj._results)
示例#2
0
def test_add(sel1, sel2, sel3):
    obj = Count()
    assert 0 == len(obj._results)

    obj = Count(selections=[sel1, sel2])
    assert 2 == len(obj._results)
    obj.add(sel3)
    assert 3 == len(obj._results)
示例#3
0
    def test_one(self):
        obj = Count()
        sel1 = MockEventSelection(name='sel1')
        obj.add(sel1)

        self.assertEqual([
            [1, 'MockEventSelection', 'sel1', 0, 0],
        ], obj._results)

        obj.count(pass_=[True])
        self.assertEqual([
            [1, 'MockEventSelection', 'sel1', 1, 1],
        ], obj._results)

        obj.count(pass_=[False])
        self.assertEqual([
            [1, 'MockEventSelection', 'sel1', 1, 2],
        ], obj._results)