def test_case_insensitive_dict_key_value_update(self): d = CaseInsensitiveDict({"X-key": "X-value"}) d["x-key"] = "x-value" self.assertEqual(1, len(d)) self.assertEqual("x-key", list(d.keys())[0]) self.assertEqual("x-value", list(d.values())[0]) self.assertEqual("x-value", d["x-key"])
def headers(self, value): self._headers = CaseInsensitiveDict(value) or CaseInsensitiveDict()
def case_insensitive_dict(self): return CaseInsensitiveDict(self.json)
def test_case_insensitive_dict_key_value_name_duplicated_keys(self): d = CaseInsensitiveDict({"X-key": "X-value", "x-key": "x-value"}) self.assertEqual(1, len(d)) self.assertEqual("X-key".lower(), list(d.keys())[0].lower())
def __init__(self, json_data): self.json = json_data self.case_insensitive_dict = CaseInsensitiveDict(self.json)