Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
anguillanneuf committed Feb 8, 2022
1 parent c156e3d commit c5a34c9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
8 changes: 2 additions & 6 deletions samples/snippets/subscriber.py
Expand Up @@ -236,11 +236,7 @@ def create_subscription_with_filtering(

with subscriber:
subscription = subscriber.create_subscription(
request={
"name": subscription_path,
"topic": topic_path,
"filter": filter,
}
request={"name": subscription_path, "topic": topic_path, "filter": filter}
)
print(f"Created subscription with filtering enabled: {subscription}")
# [END pubsub_create_subscription_with_filter]
Expand Down Expand Up @@ -771,7 +767,7 @@ def callback(message: pubsub_v1.subscriber.message.Message) -> None:
# [END pubsub_dead_letter_delivery_attempt]


if __name__ == "__main__":
if __name__ == "__main__": # noqa
parser = argparse.ArgumentParser(
description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter,
)
Expand Down
8 changes: 5 additions & 3 deletions samples/snippets/subscriber_test.py
Expand Up @@ -43,7 +43,7 @@
NEW_ENDPOINT = f"https://{PROJECT_ID}.appspot.com/push2"
DEFAULT_MAX_DELIVERY_ATTEMPTS = 5
UPDATED_MAX_DELIVERY_ATTEMPTS = 20
FILTER = "attributes.author=\"unknown\""
FILTER = 'attributes.author="unknown"'

C = TypeVar("C", bound=Callable[..., Any])

Expand Down Expand Up @@ -401,12 +401,14 @@ def test_create_subscription_with_filtering(
except NotFound:
pass

subscriber.create_subscription_with_filtering(PROJECT_ID, TOPIC, SUBSCRIPTION_ADMIN, FILTER)
subscriber.create_subscription_with_filtering(
PROJECT_ID, TOPIC, SUBSCRIPTION_ADMIN, FILTER
)

out, _ = capsys.readouterr()
assert "Created subscription with filtering enabled" in out
assert f"{subscription_admin}" in out
assert f"filter: {FILTER}" in out
assert '"attributes.author=\\"unknown\\""' in out


def test_create_push_subscription(
Expand Down

0 comments on commit c5a34c9

Please sign in to comment.