예제 #1
0
def test_transform_callback_err(data):
    ctx = MockContext()
    ctx.obj['like'] = {'transform': 'foo'}
    with pytest.raises(click.BadParameter):
        info.transform_handler(ctx, MockOption('transform'), '?')
예제 #2
0
def test_transform_callback(data):
    ctx = MockContext()
    ctx.obj['like'] = {'transform': 'foo'}
    assert info.transform_handler(ctx, MockOption('transform'),
                                  'like') == 'foo'
예제 #3
0
def test_transform_callback(data):
    ctx = MockContext()
    ctx.obj["like"] = {"transform": "foo"}
    assert info.transform_handler(ctx, MockOption("transform"), "like") == "foo"
예제 #4
0
def test_transform_callback_pass(data):
    """Always return None if the value is None"""
    ctx = MockContext()
    ctx.obj['like'] = {'transform': 'foo'}
    assert info.transform_handler(ctx, MockOption('transform'), None) is None
예제 #5
0
def test_transform_callback_err(data):
    ctx = MockContext()
    ctx.obj["like"] = {"transform": "foo"}
    with pytest.raises(click.BadParameter):
        info.transform_handler(ctx, MockOption("transform"), "?")
예제 #6
0
def test_transform_callback_pass(data):
    """Always return None if the value is None"""
    ctx = MockContext()
    ctx.obj["like"] = {"transform": "foo"}
    assert info.transform_handler(ctx, MockOption("transform"), None) is None
예제 #7
0
def test_transform_callback(data):
    ctx = MockContext()
    ctx.obj['like'] = {'transform': 'foo'}
    assert info.transform_handler(ctx, MockOption('transform'), 'like') == 'foo'
예제 #8
0
def test_transform_callback_err(data):
    ctx = MockContext()
    ctx.obj['like'] = {'transform': 'foo'}
    with pytest.raises(click.BadParameter):
        info.transform_handler(ctx, MockOption('transform'), '?')
예제 #9
0
def test_transform_callback_pass(data):
    """Always return None if the value is None"""
    ctx = MockContext()
    ctx.obj['like'] = {'transform': 'foo'}
    assert info.transform_handler(ctx, MockOption('transform'), None) is None