anchor.diff:              invalid_input_error(Inputs)
       end.
   
  +normalize_bucket_and_type(Bucket) when is_binary(Bucket) ->
  +    Bucket;
  +normalize_bucket_and_type([Type, Bucket]) when is_binary(Bucket),
  +                                               is_binary(Type) ->
  +    {Type, Bucket}.
  +
   is_keyfilter_input(Inputs) when is_list(Inputs) ->
       HasBucket = proplists:get_value(<<"bucket">>, Inputs) /= undefined,
       HasKeyFilters = proplists:get_value(<<"key_filters">>, Inputs) /= undefined,
  
positive.code: 
      JSON2 = <<"{\"bucket\":\"mybucket\",\"index\":\"myindex_bin\", \"start\":\"vala\", \"end\":\"valb\"}">>,
      Expected2 = {ok, {index, <<"mybucket">>, <<"myindex_bin">>, <<"vala">>, <<"valb">>}},
      ?assertEqual(Expected2, parse_inputs(mochijson2:decode(JSON2))).
  
  keyfilter_input_test() ->
      JSON = <<"{\"bucket\":\"mybucket\",\"key_filters\":[[\"match\", \"key.*\"]]}">>,
      Expected = {ok, {<<"mybucket">>, [[<<"match">>, <<"key.*">>]]}},
      ?assertEqual(Expected, parse_inputs(mochijson2:decode(JSON))).
  
  -define(DISCRETE_ERLANG_JOB, <<"{\"inputs\": [[\"foo\", \"bar\"]], \"query\":[{\"map\":{\"language\":\"erlang\","
                                "\"module\":\"foo\", \"function\":\"bar\", \"keep\": false}}]}">>).
  
negative.code:                       {{<<"b2">>, <<"k2">>}, <<"v2">>},
                        {{<<"b3">>, <<"k3">>}, <<"v3">>}
                       ]},
      ?assertEqual(Expected2, parse_inputs(mochijson2:decode(JSON2))),
  
      %% Test parsing bucket types
      JSON3 = <<"[[\"t1\", \"b1\", \"k1\", \"v1\"], [\"t2\", \"b2\", \"k2\", \"v2\"], [\"t3\", \"b3\", \"k3\", \"v3\"]]">>,
      Expected3 = {ok, [
                        {{{<<"t1">>, <<"b1">>}, <<"k1">>}, <<"v1">>},
                        {{{<<"t2">>, <<"b2">>}, <<"k2">>}, <<"v2">>},
                        {{{<<"t3">>, <<"b3">>}, <<"k3">>}, <<"v3">>}
                       ]},
      ?assertEqual(Expected3, parse_inputs(mochijson2:decode(JSON3))).
  
  modfun_input_test() ->
      JSON = <<"{\"module\":\"mymod\",\"function\":\"myfun\",\"arg\":[1,2,3]}">>,
  