예제 #1
0
def test_nodata_callback_0(data):
    ctx = MockContext()
    assert info.nodata_handler(ctx, MockOption('nodata'), '0') == 0.0
예제 #2
0
def test_nodata_callback(data):
    ctx = MockContext()
    ctx.obj['like'] = {'nodata': -1}
    assert info.nodata_handler(ctx, MockOption('nodata'), 'like') == -1.0
예제 #3
0
def test_nodata_callback_err(data):
    ctx = MockContext()
    ctx.obj['like'] = {'nodata': 'lolwut'}
    with pytest.raises(click.BadParameter):
        info.nodata_handler(ctx, MockOption('nodata'), 'lolwut')
예제 #4
0
def test_nodata_callback_pass(data):
    """Always return None if the value is None"""
    ctx = MockContext()
    ctx.obj['like'] = {'nodata': -1}
    assert info.nodata_handler(ctx, MockOption('nodata'), None) is None
예제 #5
0
def test_nodata_callback_0(data):
    ctx = MockContext()
    assert info.nodata_handler(ctx, MockOption("nodata"), "0") == 0.0
예제 #6
0
def test_nodata_callback(data):
    ctx = MockContext()
    ctx.obj["like"] = {"nodata": -1}
    assert info.nodata_handler(ctx, MockOption("nodata"), "like") == -1.0
예제 #7
0
def test_nodata_callback_pass(data):
    """Always return None if the value is None"""
    ctx = MockContext()
    ctx.obj["like"] = {"nodata": -1}
    assert info.nodata_handler(ctx, MockOption("nodata"), None) is None
예제 #8
0
def test_nodata_callback_err(data):
    ctx = MockContext()
    ctx.obj["like"] = {"nodata": "lolwut"}
    with pytest.raises(click.BadParameter):
        info.nodata_handler(ctx, MockOption("nodata"), "lolwut")
예제 #9
0
def test_nodata_callback(data):
    ctx = MockContext()
    ctx.obj['like'] = {'nodata': -1}
    assert info.nodata_handler(ctx, MockOption('nodata'), 'like') == -1.0
예제 #10
0
def test_nodata_callback_0(data):
    ctx = MockContext()
    assert info.nodata_handler(ctx, MockOption('nodata'), '0') == 0.0
예제 #11
0
def test_nodata_callback_err(data):
    ctx = MockContext()
    ctx.obj['like'] = {'nodata': 'lolwut'}
    with pytest.raises(click.BadParameter):
        info.nodata_handler(ctx, MockOption('nodata'), 'lolwut')