Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: DictWrapper equals method #234

Merged
merged 3 commits into from
Dec 7, 2020
Merged
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
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