Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions aws_lambda_powertools/utilities/data_classes/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ def __eq__(self, other):
other = CaseInsensitiveDict(other)
return super().__eq__(other)

def __ne__(self, other):
return not self.__eq__(other)

def __getitem__(self, k):
return super().__getitem__(k.lower())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,10 @@ def test_case_insensitive_dict_merge_rejects_non_mapping():

with pytest.raises(TypeError):
[("X-Trace-Id", "abc")] | headers


def test_case_insensitive_dict_ne_matches_eq_semantics():
headers = CaseInsensitiveDict({"Content-Type": "application/json"})

assert headers == {"Content-Type": "application/json"}
assert not headers != {"Content-Type": "application/json"}