def test_multiple_processor_error(exception_class, expected_exception_class): processor = MultipleProcessor( lambda x: raise_(exception_class, 'invalid_value'), lambda x: x.lower()) with pytest.raises(expected_exception_class): processor('value')
def test_multiple_processor_none_if_error(): processor = MultipleProcessor(lambda x: x.strip(), lambda x: x.lower()) processor.raise_error = False processor.none_if_error = True assert processor(100) is None
def test_multiple_processor_without_error(): processor = MultipleProcessor(lambda x: x.strip(), lambda x: x.lower()) processor.raise_error = False assert processor(100) == 100
def test_multiple_processor(value, expected_value): processor = MultipleProcessor(strip, lower) assert processor(value) == expected_value