Skip to content
Myr

test_structures.py

This file

Path

tests/test_structures.py

78 lines · 2.2 KiB · Python

Last changed by

Add automatic code formatting to Requests (#6095)Nate Prewittbefore adoption2a6f290

History of this file

Take it

The walk stopped after 200 commits: lines older than 590350f point at it.

Update Bug_report.md (#5965)Alan Yeebefore adoption590350f

lines 1–10why, one step back
1import pytest
23from requests.structures import CaseInsensitiveDict, LookupDict456class TestCaseInsensitiveDict:7 @pytest.fixture(autouse=True)8 def setup(self):9 """CaseInsensitiveDict instance with "Accept" header."""10 self.case_insensitive_dict = CaseInsensitiveDict()

Add automatic code formatting to Requests (#6095)Nate Prewittbefore adoption2a6f290

line 11why, one step back
11 self.case_insensitive_dict["Accept"] = "application/json"

Update Bug_report.md (#5965)Alan Yeebefore adoption590350f

lines 12–13why, one step back
12
13 def test_list(self):

Add automatic code formatting to Requests (#6095)Nate Prewittbefore adoption2a6f290

line 14why, one step back
14 assert list(self.case_insensitive_dict) == ["Accept"]

Update Bug_report.md (#5965)Alan Yeebefore adoption590350f

line 15why, one step back
15

Add automatic code formatting to Requests (#6095)Nate Prewittbefore adoption2a6f290

lines 16–18why, one step back
16 possible_keys = pytest.mark.parametrize(
17 "key", ("accept", "ACCEPT", "aCcEpT", "Accept")18 )

Update Bug_report.md (#5965)Alan Yeebefore adoption590350f

lines 19–21why, one step back
19
20 @possible_keys21 def test_getitem(self, key):

Add automatic code formatting to Requests (#6095)Nate Prewittbefore adoption2a6f290

line 22why, one step back
22 assert self.case_insensitive_dict[key] == "application/json"

Update Bug_report.md (#5965)Alan Yeebefore adoption590350f

lines 23–29why, one step back
23
24 @possible_keys25 def test_delitem(self, key):26 del self.case_insensitive_dict[key]27 assert key not in self.case_insensitive_dict2829 def test_lower_items(self):

Add automatic code formatting to Requests (#6095)Nate Prewittbefore adoption2a6f290

lines 30–32why, one step back
30 assert list(self.case_insensitive_dict.lower_items()) == [
31 ("accept", "application/json")32 ]

Update Bug_report.md (#5965)Alan Yeebefore adoption590350f

lines 33–42why, one step back
33
34 def test_repr(self):35 assert repr(self.case_insensitive_dict) == "{'Accept': 'application/json'}"3637 def test_copy(self):38 copy = self.case_insensitive_dict.copy()39 assert copy is not self.case_insensitive_dict40 assert copy == self.case_insensitive_dict4142 @pytest.mark.parametrize(

Add automatic code formatting to Requests (#6095)Nate Prewittbefore adoption2a6f290

lines 43–45why, one step back
43 "other, result",
44 (45 ({"AccePT": "application/json"}, True),

Update Bug_report.md (#5965)Alan Yeebefore adoption590350f

line 46why, one step back
46 ({}, False),

Add automatic code formatting to Requests (#6095)Nate Prewittbefore adoption2a6f290

lines 47–48why, one step back
47 (None, False),
48 ),

Update Bug_report.md (#5965)Alan Yeebefore adoption590350f

lines 49–57why, one step back
49 )
50 def test_instance_equality(self, other, result):51 assert (self.case_insensitive_dict == other) is result525354class TestLookupDict:55 @pytest.fixture(autouse=True)56 def setup(self):57 """LookupDict instance with "bad_gateway" attribute."""

Add automatic code formatting to Requests (#6095)Nate Prewittbefore adoption2a6f290

line 58why, one step back
58 self.lookup_dict = LookupDict("test")

Update Bug_report.md (#5965)Alan Yeebefore adoption590350f

lines 59–64why, one step back
59 self.lookup_dict.bad_gateway = 502
6061 def test_repr(self):62 assert repr(self.lookup_dict) == "<lookup 'test'>"6364 get_item_parameters = pytest.mark.parametrize(

Add automatic code formatting to Requests (#6095)Nate Prewittbefore adoption2a6f290

lines 65–69why, one step back
65 "key, value",
66 (67 ("bad_gateway", 502),68 ("not_a_key", None),69 ),

Update Bug_report.md (#5965)Alan Yeebefore adoption590350f

lines 70–78why, one step back
70 )
7172 @get_item_parameters73 def test_getitem(self, key, value):74 assert self.lookup_dict[key] == value7576 @get_item_parameters77 def test_get(self, key, value):78 assert self.lookup_dict.get(key) == value