caseinsensitivedict instance with accept header self caseinsensitivedict caseinsensitivedict self caseinsensitivedictaccept applicationjson def testlistself assert listself caseinsensitivedict accept possiblekeys pytest mark parametrize key accept accept accept accept possiblekeys def testgetitemself key assert self caseinsensitivedictkey applicationjson possiblekeys def testdelitemself key del self caseinsensitivedictkey assert key not in self caseinsensitivedict def testloweritemsself assert listself caseinsensitivedict loweritems accept applicationjson def testreprself assert reprself caseinsensitivedict accept applicationjson def testcopyself copy self caseinsensitivedict copy assert copy is not self caseinsensitivedict assert copy self caseinsensitivedict pytest mark parametrize other result accept applicationjson true false none false def testinstanceequalityself other result assert self caseinsensitivedict other is result class testlookupdict pytest fixtureautousetrue def setupself caseinsensitivedict instance with accept header lookupdict instance with bad_gateway attribute
import pytest

from requests.structures import CaseInsensitiveDict, LookupDict


class TestCaseInsensitiveDict:
    @pytest.fixture(autouse=True)
    def setup(self):
        
        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):
        
        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