-
Notifications
You must be signed in to change notification settings - Fork 58
Improve public API type annotations & fix unit test type errors #248
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
base: main
Are you sure you want to change the base?
Changes from all commits
e9b6301
eacac4f
f81c902
b70ef0a
66aa64b
a3291f5
029d122
f611c29
dccd3cf
130cdfa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ | |
@pytest.mark.parametrize("event_class", [v03.Event, v1.Event]) | ||
def test_binary_converter_upstream(event_class): | ||
m = marshaller.NewHTTPMarshaller([binary.NewBinaryHTTPCloudEventConverter()]) | ||
event = m.FromRequest(event_class(), data.headers[event_class], None, lambda x: x) | ||
event = m.FromRequest(event_class(), data.headers[event_class], b"", lambda x: x) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using |
||
assert event is not None | ||
assert event.EventType() == data.ce_type | ||
assert event.EventID() == data.ce_id | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,7 +77,7 @@ def test_object_event_v1(): | |
_, structured_body = m.ToRequest(event) | ||
assert isinstance(structured_body, bytes) | ||
structured_obj = json.loads(structured_body) | ||
error_msg = f"Body was {structured_body}, obj is {structured_obj}" | ||
error_msg = f"Body was {structured_body!r}, obj is {structured_obj}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lint error warning that bytes would be formatted as a quoted repr, unlike str, so it demands explicit repr ( |
||
assert isinstance(structured_obj, dict), error_msg | ||
assert isinstance(structured_obj["data"], dict), error_msg | ||
assert len(structured_obj["data"]) == 1, error_msg | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Self is not in stdlib
typing
module in older Python versions, so needs a typing-only import.