Beispiel #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)
Beispiel #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
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
Beispiel #4
0
def obj2(obj2_results_org):
    ret = Count()
    ret._results = copy.deepcopy(obj2_results_org)
    return ret
def obj2(obj2_results_org):
    ret = Count()
    ret._results = copy.deepcopy(obj2_results_org)
    return ret