def test_collect_arrays(): obj = KeyValueComposer() event = MockEvent() event.var1 = [ ] event.var2 = [ ] event.var3 = [ ] attr_names = ('var1', 'var2', 'var3') arrays = obj._collect_arrays(event, attr_names) assert event.var1 is arrays[0] assert event.var2 is arrays[1] assert event.var3 is arrays[2]
def test_collect_arrays(): obj = KeyValueComposer() event = MockEvent() event.var1 = [] event.var2 = [] event.var3 = [] attr_names = ('var1', 'var2', 'var3') arrays = obj._collect_arrays(event, attr_names) assert event.var1 is arrays[0] assert event.var2 is arrays[1] assert event.var3 is arrays[2]
def test_collect_arrays_error(caplog): obj = KeyValueComposer() event = MockEvent() event.var1 = [ ] event.var2 = [ ] attr_names = ('var1', 'var2', 'var3') # var3 doesn't exist with caplog.at_level(logging.WARNING): arrays = obj._collect_arrays(event, attr_names) assert arrays is None assert len(caplog.records) == 1 assert caplog.records[0].levelname == 'WARNING' assert 'KeyValueComposer' in caplog.records[0].name assert 'has no attribute' in caplog.records[0].msg
def test_collect_arrays_error(caplog): obj = KeyValueComposer() event = MockEvent() event.var1 = [] event.var2 = [] attr_names = ('var1', 'var2', 'var3') # var3 doesn't exist with caplog.at_level(logging.WARNING): arrays = obj._collect_arrays(event, attr_names) assert arrays is None assert len(caplog.records) == 1 assert caplog.records[0].levelname == 'WARNING' assert 'KeyValueComposer' in caplog.records[0].name assert 'has no attribute' in caplog.records[0].msg