def test_nodata_callback_0(data): ctx = MockContext() assert info.nodata_handler(ctx, MockOption('nodata'), '0') == 0.0
def test_nodata_callback(data): ctx = MockContext() ctx.obj['like'] = {'nodata': -1} assert info.nodata_handler(ctx, MockOption('nodata'), 'like') == -1.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')
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
def test_nodata_callback_0(data): ctx = MockContext() assert info.nodata_handler(ctx, MockOption("nodata"), "0") == 0.0
def test_nodata_callback(data): ctx = MockContext() ctx.obj["like"] = {"nodata": -1} assert info.nodata_handler(ctx, MockOption("nodata"), "like") == -1.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
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")