Skip to content

Commit

Permalink
test: DictWrapper equals method
Browse files Browse the repository at this point in the history
Added a equals test to  test the `__eq__` method.

Related Issue: #233
  • Loading branch information
Joris Conijn committed Dec 7, 2020
1 parent bf4ef14 commit 6bc09b0
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tests/functional/test_lambda_trigger_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
UserMigrationTriggerEvent,
VerifyAuthChallengeResponseTriggerEvent,
)
from aws_lambda_powertools.utilities.data_classes.common import BaseProxyEvent
from aws_lambda_powertools.utilities.data_classes.common import BaseProxyEvent, DictWrapper
from aws_lambda_powertools.utilities.data_classes.dynamo_db_stream_event import (
AttributeValue,
DynamoDBRecordEventName,
Expand All @@ -43,6 +43,16 @@ def load_event(file_name: str) -> dict:
return json.load(fp)


def test_dict_wrapper_equals():
class DataClassSample(DictWrapper):
@property
def message(self) -> str:
return self.get("message")

assert DataClassSample({"message": "foo1"}) == DataClassSample({"message": "foo1"})
assert DataClassSample({"message": "foo1"}) != DataClassSample({"message": "foo2"})


def test_cloud_watch_trigger_event():
event = CloudWatchLogsEvent(load_event("cloudWatchLogEvent.json"))

Expand Down

0 comments on commit 6bc09b0

Please sign in to comment.