def test_bounds_handler_json(): """handle JSON bbox""" ctx = MockContext() retval = bounds_handler(ctx, 'bounds', '[1.0, 0.0, 1.0, 0.0]') assert retval == (1.0, 0.0, 1.0, 0.0)
def test_bounds_handler_non_json(): """handle non-JSON bbox""" ctx = MockContext() retval = bounds_handler(ctx, 'bounds', '1.0 0.0 1.0 0.0') assert retval == (1.0, 0.0, 1.0, 0.0)
def test_bounds_handler_commas(): """handle non-JSON bbox with commas""" ctx = MockContext() retval = bounds_handler(ctx, 'bounds', '1.0, 0.0, 1.0 , 0.0') assert retval == (1.0, 0.0, 1.0, 0.0)
def test_bounds_handler_3_items(): """fail if less than 4 numbers in the bbox""" ctx = MockContext() with pytest.raises(click.BadParameter): bounds_handler(ctx, 'bounds', '1.0 0.0 1.0')
def test_bounds_handler_non_number(): """fail if there's a non-number in the bbox""" ctx = MockContext() with pytest.raises(click.BadParameter): bounds_handler(ctx, 'bounds', '1.0 surprise! 1.0')
def test_bounds_handler_json(): """handle JSON bbox""" ctx = MockContext() retval = bounds_handler(ctx, 'bounds', '[1.0, 0.0, 1.0, 0.0]') assert retval == (1.0, 0.0, 1.0, 0.0)
def test_bounds_handler_commas(): """handle non-JSON bbox with commas""" ctx = MockContext() retval = bounds_handler(ctx, 'bounds', '1.0, 0.0, 1.0 , 0.0') assert retval == (1.0, 0.0, 1.0, 0.0)
def test_bounds_handler_non_json(): """handle non-JSON bbox""" ctx = MockContext() retval = bounds_handler(ctx, 'bounds', '1.0 0.0 1.0 0.0') assert retval == (1.0, 0.0, 1.0, 0.0)
def test_bounds_handler_non_number(): """fail if there's a non-number in the bbox""" ctx = MockContext() with pytest.raises(click.BadParameter): bounds_handler(ctx, 'bounds', '1.0 surprise! 1.0')
def test_bounds_handler_3_items(): """fail if less than 4 numbers in the bbox""" ctx = MockContext() with pytest.raises(click.BadParameter): bounds_handler(ctx, 'bounds', '1.0 0.0 1.0')