MCPcopy
hub / github.com/openai/openai-python / test_request_extra_query

Method test_request_extra_query

tests/test_client.py:696–735  ·  view source on GitHub ↗
(self, client: OpenAI)

Source from the content-addressed store, hash-verified

694 assert request.headers.get("X-Bar") == "false"
695
696 def test_request_extra_query(self, client: OpenAI) -> None:
697 request = client._build_request(
698 FinalRequestOptions(
699 method="post",
700 url="/foo",
701 **make_request_options(
702 extra_query={"my_query_param": "Foo"},
703 ),
704 ),
705 )
706 params = dict(request.url.params)
707 assert params == {"my_query_param": "Foo"}
708
709 # if both `query` and `extra_query` are given, they are merged
710 request = client._build_request(
711 FinalRequestOptions(
712 method="post",
713 url="/foo",
714 **make_request_options(
715 query={"bar": "1"},
716 extra_query={"foo": "2"},
717 ),
718 ),
719 )
720 params = dict(request.url.params)
721 assert params == {"bar": "1", "foo": "2"}
722
723 # `extra_query` takes priority over `query` when keys clash
724 request = client._build_request(
725 FinalRequestOptions(
726 method="post",
727 url="/foo",
728 **make_request_options(
729 query={"foo": "1"},
730 extra_query={"foo": "2"},
731 ),
732 ),
733 )
734 params = dict(request.url.params)
735 assert params == {"foo": "2"}
736
737 def test_multipart_repeating_array(self, client: OpenAI) -> None:
738 request = client._build_request(

Callers

nothing calls this directly

Calls 3

FinalRequestOptionsClass · 0.90
make_request_optionsFunction · 0.90
_build_requestMethod · 0.45

Tested by

no test coverage detected