Home / Function/ test_post_with_custom_mapping() — requests Function Reference

test_post_with_custom_mapping() — requests Function Reference

Architecture documentation for the test_post_with_custom_mapping() function in test_requests.py from the requests codebase.

Entity Profile

Dependency Diagram

graph TD
  b0f60ef1_1559_0677_4c5f_be72db86c5f1["test_post_with_custom_mapping()"]
  22b80b19_26d4_cd0e_c476_3edf87b3df14["TestRequests"]
  b0f60ef1_1559_0677_4c5f_be72db86c5f1 -->|defined in| 22b80b19_26d4_cd0e_c476_3edf87b3df14
  style b0f60ef1_1559_0677_4c5f_be72db86c5f1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_requests.py lines 891–914

    def test_post_with_custom_mapping(self, httpbin):
        class CustomMapping(MutableMapping):
            def __init__(self, *args, **kwargs):
                self.data = dict(*args, **kwargs)

            def __delitem__(self, key):
                del self.data[key]

            def __getitem__(self, key):
                return self.data[key]

            def __setitem__(self, key, value):
                self.data[key] = value

            def __iter__(self):
                return iter(self.data)

            def __len__(self):
                return len(self.data)

        data = CustomMapping({"some": "data"})
        url = httpbin("post")
        found_json = requests.post(url, data=data).json().get("form")
        assert found_json == {"some": "data"}

Domain

Subdomains

Frequently Asked Questions

What does test_post_with_custom_mapping() do?
test_post_with_custom_mapping() is a function in the requests codebase, defined in tests/test_requests.py.
Where is test_post_with_custom_mapping() defined?
test_post_with_custom_mapping() is defined in tests/test_requests.py at line 891.

Analyze Your Own Codebase

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

Try Supermodel Free