]> git.ipfire.org Git - thirdparty/httpx.git/commitdiff
Revert "Raise `TypeError` on invalid query params. (#2523)" (#2539)
authorMichael Adkins <michael@prefect.io>
Wed, 4 Jan 2023 09:23:32 +0000 (03:23 -0600)
committerGitHub <noreply@github.com>
Wed, 4 Jan 2023 09:23:32 +0000 (09:23 +0000)
This reverts commit 4cbf13ece2e584b45b935df0a0c670e1863c4569.

httpx/_utils.py
tests/models/test_queryparams.py

index 1e1570ee7f40ec80d334410b0cd43727000f8585..1f64deedcda337d6437b2c9a8ab205cc3ee0fc51 100644 (file)
@@ -67,11 +67,7 @@ def primitive_value_to_str(value: "PrimitiveData") -> str:
         return "false"
     elif value is None:
         return ""
-    elif isinstance(value, (str, float, int)):
-        return str(value)
-    raise TypeError(
-        f"Expected str, int, float, bool, or None. Got {type(value).__name__!r}."
-    )
+    return str(value)
 
 
 def is_known_encoding(encoding: str) -> bool:
index cbb487bbc645d51c62f522045912e0b4a05ff77b..29b2ca634d73036db3b10e55e965a915e70de6e6 100644 (file)
@@ -87,13 +87,6 @@ def test_empty_query_params():
     assert str(q) == "a="
 
 
-def test_invalid_query_params():
-    with pytest.raises(
-        TypeError, match=r"Expected str, int, float, bool, or None. Got 'bytes'."
-    ):
-        httpx.QueryParams({"a": b"bytes"})
-
-
 def test_queryparam_update_is_hard_deprecated():
     q = httpx.QueryParams("a=123")
     with pytest.raises(RuntimeError):