test_structures.py — requests Source File
Architecture documentation for test_structures.py, a python file in the requests codebase. 2 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 733a3397_4d8b_4610_9dd6_21f99211b86c["test_structures.py"] b820826b_04e7_9e1b_bbf6_b336eaff9a23["pytest"] 733a3397_4d8b_4610_9dd6_21f99211b86c --> b820826b_04e7_9e1b_bbf6_b336eaff9a23 4f68cab0_7608_e6eb_7403_410ab83b8f76["requests.structures"] 733a3397_4d8b_4610_9dd6_21f99211b86c --> 4f68cab0_7608_e6eb_7403_410ab83b8f76 style 733a3397_4d8b_4610_9dd6_21f99211b86c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import pytest
from requests.structures import CaseInsensitiveDict, LookupDict
class TestCaseInsensitiveDict:
@pytest.fixture(autouse=True)
def setup(self):
"""CaseInsensitiveDict instance with "Accept" header."""
self.case_insensitive_dict = CaseInsensitiveDict()
self.case_insensitive_dict["Accept"] = "application/json"
def test_list(self):
assert list(self.case_insensitive_dict) == ["Accept"]
possible_keys = pytest.mark.parametrize(
"key", ("accept", "ACCEPT", "aCcEpT", "Accept")
)
@possible_keys
def test_getitem(self, key):
assert self.case_insensitive_dict[key] == "application/json"
@possible_keys
def test_delitem(self, key):
del self.case_insensitive_dict[key]
assert key not in self.case_insensitive_dict
def test_lower_items(self):
assert list(self.case_insensitive_dict.lower_items()) == [
("accept", "application/json")
]
def test_repr(self):
assert repr(self.case_insensitive_dict) == "{'Accept': 'application/json'}"
def test_copy(self):
copy = self.case_insensitive_dict.copy()
assert copy is not self.case_insensitive_dict
assert copy == self.case_insensitive_dict
@pytest.mark.parametrize(
"other, result",
(
({"AccePT": "application/json"}, True),
({}, False),
(None, False),
),
)
def test_instance_equality(self, other, result):
assert (self.case_insensitive_dict == other) is result
class TestLookupDict:
@pytest.fixture(autouse=True)
def setup(self):
"""LookupDict instance with "bad_gateway" attribute."""
self.lookup_dict = LookupDict("test")
self.lookup_dict.bad_gateway = 502
def test_repr(self):
assert repr(self.lookup_dict) == "<lookup 'test'>"
get_item_parameters = pytest.mark.parametrize(
"key, value",
(
("bad_gateway", 502),
("not_a_key", None),
),
)
@get_item_parameters
def test_getitem(self, key, value):
assert self.lookup_dict[key] == value
@get_item_parameters
def test_get(self, key, value):
assert self.lookup_dict.get(key) == value
Domain
Subdomains
Dependencies
- pytest
- requests.structures
Source
Frequently Asked Questions
What does test_structures.py do?
test_structures.py is a source file in the requests codebase, written in python. It belongs to the CoreAPI domain, SessionLifecycle subdomain.
What does test_structures.py depend on?
test_structures.py imports 2 module(s): pytest, requests.structures.
Where is test_structures.py in the architecture?
test_structures.py is located at tests/test_structures.py (domain: CoreAPI, subdomain: SessionLifecycle, directory: tests).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free