Home / Class/ TestGuessJSONUTF Class — requests Architecture

TestGuessJSONUTF Class — requests Architecture

Architecture documentation for the TestGuessJSONUTF class in test_utils.py from the requests codebase.

Entity Profile

Dependency Diagram

graph TD
  696afb1b_f9a7_889a_c705_b973d3155e32["TestGuessJSONUTF"]
  5828793e_be5b_8952_37f1_338fd4634a1a["test_utils.py"]
  696afb1b_f9a7_889a_c705_b973d3155e32 -->|defined in| 5828793e_be5b_8952_37f1_338fd4634a1a
  a2042522_96c7_493d_d732_3697fb837111["test_encoded()"]
  696afb1b_f9a7_889a_c705_b973d3155e32 -->|method| a2042522_96c7_493d_d732_3697fb837111
  de0da195_927c_47e0_23fa_6062f830adfa["test_bad_utf_like_encoding()"]
  696afb1b_f9a7_889a_c705_b973d3155e32 -->|method| de0da195_927c_47e0_23fa_6062f830adfa
  be184a75_aab0_3c4c_c753_6b5bf8cd7199["test_guess_by_bom()"]
  696afb1b_f9a7_889a_c705_b973d3155e32 -->|method| be184a75_aab0_3c4c_c753_6b5bf8cd7199

Relationship Graph

Source Code

tests/test_utils.py lines 395–427

class TestGuessJSONUTF:
    @pytest.mark.parametrize(
        "encoding",
        (
            "utf-32",
            "utf-8-sig",
            "utf-16",
            "utf-8",
            "utf-16-be",
            "utf-16-le",
            "utf-32-be",
            "utf-32-le",
        ),
    )
    def test_encoded(self, encoding):
        data = "{}".encode(encoding)
        assert guess_json_utf(data) == encoding

    def test_bad_utf_like_encoding(self):
        assert guess_json_utf(b"\x00\x00\x00\x00") is None

    @pytest.mark.parametrize(
        ("encoding", "expected"),
        (
            ("utf-16-be", "utf-16"),
            ("utf-16-le", "utf-16"),
            ("utf-32-be", "utf-32"),
            ("utf-32-le", "utf-32"),
        ),
    )
    def test_guess_by_bom(self, encoding, expected):
        data = "\ufeff{}".encode(encoding)
        assert guess_json_utf(data) == expected

Domain

Defined In

Frequently Asked Questions

What is the TestGuessJSONUTF class?
TestGuessJSONUTF is a class in the requests codebase, defined in tests/test_utils.py.
Where is TestGuessJSONUTF defined?
TestGuessJSONUTF is defined in tests/test_utils.py at line 395.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free