def test_transform_callback(data): ctx = MockContext() ctx.obj['like'] = {'transform': 'foo'} assert transform_handler(ctx, MockOption('transform'), 'like') == 'foo'
def test_transform_callback_err(data): ctx = MockContext() ctx.obj['like'] = {'transform': 'foo'} with pytest.raises(click.BadParameter): transform_handler(ctx, MockOption('transform'), '?')
def test_transform_callback_pass(data): """Always return None if the value is None""" ctx = MockContext() ctx.obj['like'] = {'transform': 'foo'} assert transform_handler(ctx, MockOption('transform'), None) is None