Skip to content

Commit

Permalink
Merge pull request #234 from Nr18/test-equal
Browse files Browse the repository at this point in the history
test: DictWrapper equals method
  • Loading branch information
heitorlessa authored Dec 7, 2020
2 parents bf4ef14 + 0ab2786 commit 497d5d7
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 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,21 @@ 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")

data1 = {"message": "foo1"}
data2 = {"message": "foo2"}

assert DataClassSample(data1) == DataClassSample(data1)
assert DataClassSample(data1) != DataClassSample(data2)
assert DataClassSample(data1) is not data1
assert data1 is not DataClassSample(data1)


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

Expand Down

0 comments on commit 497d5d7

Please sign in to comment.