Skip to content

Commit 6bc09b0

Browse files
author
Joris Conijn
committed
test: DictWrapper equals method
Added a equals test to test the `__eq__` method. Related Issue: #233
1 parent bf4ef14 commit 6bc09b0

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tests/functional/test_lambda_trigger_events.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
UserMigrationTriggerEvent,
2929
VerifyAuthChallengeResponseTriggerEvent,
3030
)
31-
from aws_lambda_powertools.utilities.data_classes.common import BaseProxyEvent
31+
from aws_lambda_powertools.utilities.data_classes.common import BaseProxyEvent, DictWrapper
3232
from aws_lambda_powertools.utilities.data_classes.dynamo_db_stream_event import (
3333
AttributeValue,
3434
DynamoDBRecordEventName,
@@ -43,6 +43,16 @@ def load_event(file_name: str) -> dict:
4343
return json.load(fp)
4444

4545

46+
def test_dict_wrapper_equals():
47+
class DataClassSample(DictWrapper):
48+
@property
49+
def message(self) -> str:
50+
return self.get("message")
51+
52+
assert DataClassSample({"message": "foo1"}) == DataClassSample({"message": "foo1"})
53+
assert DataClassSample({"message": "foo1"}) != DataClassSample({"message": "foo2"})
54+
55+
4656
def test_cloud_watch_trigger_event():
4757
event = CloudWatchLogsEvent(load_event("cloudWatchLogEvent.json"))
4858

0 commit comments

Comments
 (0)