def test_default_param_assigned(processor_type): """Passing a Param value should have lower priority than the explicitly set Param value""" processor = processor_type(param_1='giraffe', is_output=False) ensured = ensure_processor(processor, is_output=True) assert not ensured.is_output
def test_default_param_omitted(processor_type): """Passing a Param value should set its default""" processor = processor_type(param_1='giraffe') ensured = ensure_processor(processor, is_output=True) assert ensured.is_output
def test_function(unbound_function): """Passing a function should create a FunctionProcessor""" ensured = ensure_processor(unbound_function) assert isinstance(ensured, FunctionProcessor)
def test_invalid(): """Passing anythin but a callable or Processor should raise a TypeError""" with pytest.raises(TypeError): ensure_processor('mummy')
def test_processor(processor_type): """Passing an existing Processor should not create a new one.""" processor = processor_type(param_1='giraffe') ensured = ensure_processor(processor) assert processor is ensured