Ejemplo n.º 1
0
 def test_add_incompatible_different_length(self):
     obj2 = Count()
     obj2._results = [
         [1, 'class1', 'name1', 3, 5],
         [1, 'class1', 'name2', 2, 4],
     ]
     obj3 = self.obj1 + obj2
     self.assertEqual(self.obj1._results, obj3._results)
Ejemplo n.º 2
0
def test_add_incompatible_different_length(obj1, caplog):
    obj2 = Count()
    obj2._results = [
        [1, 'class1', 'name1', 3, 5],
        [1, 'class1', 'name2', 2, 4],
    ]

    with caplog.at_level(logging.WARNING):
        obj3 = obj1 + obj2

    assert len(caplog.records) == 1
    assert caplog.records[0].levelname == 'WARNING'
    assert 'Count' in caplog.records[0].name
    assert 'cannot add' in caplog.records[0].msg

    assert obj1._results == obj3._results
Ejemplo n.º 3
0
def test_add_incompatible_different_length(obj1, caplog):
    obj2 = Count()
    obj2._results  = [
        [1, 'class1', 'name1', 3, 5],
        [1, 'class1', 'name2', 2, 4],
    ]

    with caplog.at_level(logging.WARNING):
        obj3 = obj1 + obj2

    assert len(caplog.records) == 1
    assert caplog.records[0].levelname == 'WARNING'
    assert 'Count' in caplog.records[0].name
    assert 'cannot add' in caplog.records[0].msg

    assert obj1._results == obj3._results
Ejemplo n.º 4
0
def obj2(obj2_results_org):
    ret = Count()
    ret._results = copy.deepcopy(obj2_results_org)
    return ret
Ejemplo n.º 5
0
def obj2(obj2_results_org):
    ret = Count()
    ret._results = copy.deepcopy(obj2_results_org)
    return ret