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