Skip to content

Commit ee58529

Browse files
authored
Update formatting (#85)
1 parent 2f53151 commit ee58529

File tree

14 files changed

+109
-111
lines changed

14 files changed

+109
-111
lines changed

tests/test_functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ def test_error_paths(path):
269269

270270
@pytest.mark.parametrize(
271271
"target, source, signature_type",
272-
[(None, None, None), (pretend.stub(), pretend.stub(), pretend.stub()),],
272+
[(None, None, None), (pretend.stub(), pretend.stub(), pretend.stub())],
273273
)
274274
def test_lazy_wsgi_app(monkeypatch, target, source, signature_type):
275275
actual_app_stub = pretend.stub()

tests/test_functions/background_missing_dependency/main.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
def function(event, context):
2020
"""Test function which uses a package which has not been provided.
2121
22-
The packaged imported above does not exist. Therefore, this import should
23-
fail, the Worker should detect this error, and return appropriate load
24-
response.
22+
The packaged imported above does not exist. Therefore, this import should
23+
fail, the Worker should detect this error, and return appropriate load
24+
response.
2525
26-
Args:
27-
event: The event data which triggered this background function.
28-
context (google.cloud.functions.Context): The Cloud Functions event context.
29-
"""
26+
Args:
27+
event: The event data which triggered this background function.
28+
context (google.cloud.functions.Context): The Cloud Functions event context.
29+
"""
3030
del event
3131
del context
3232
nonexistentpackage.wontwork("This function isn't expected to work.")

tests/test_functions/background_multiple_entry_points/main.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818
def fun(name, event):
1919
"""Test function implementation.
2020
21-
It writes the expected output (entry point name and the given value) to the
22-
given file, as a response from the background function, verified by the test.
21+
It writes the expected output (entry point name and the given value) to the
22+
given file, as a response from the background function, verified by the test.
2323
24-
Args:
25-
name: Entry point function which called this helper function.
26-
event: The event which triggered this background function. Must contain
27-
entries for 'value' and 'filename' keys in the data dictionary.
28-
"""
24+
Args:
25+
name: Entry point function which called this helper function.
26+
event: The event which triggered this background function. Must contain
27+
entries for 'value' and 'filename' keys in the data dictionary.
28+
"""
2929
filename = event["filename"]
3030
value = event["value"]
3131
f = open(filename, "w")
@@ -38,15 +38,15 @@ def myFunctionFoo(
3838
): # Used in test, pylint: disable=invalid-name,unused-argument
3939
"""Test function at entry point myFunctionFoo.
4040
41-
Loaded in a test which verifies entry point handling in a file with multiple
42-
entry points.
41+
Loaded in a test which verifies entry point handling in a file with multiple
42+
entry points.
4343
44-
Args:
45-
event: The event data (as dictionary) which triggered this background
46-
function. Must contain entries for 'value' and 'filename' keys in the data
47-
dictionary.
48-
context (google.cloud.functions.Context): The Cloud Functions event context.
49-
"""
44+
Args:
45+
event: The event data (as dictionary) which triggered this background
46+
function. Must contain entries for 'value' and 'filename' keys in the data
47+
dictionary.
48+
context (google.cloud.functions.Context): The Cloud Functions event context.
49+
"""
5050
fun("myFunctionFoo", event)
5151

5252

@@ -55,15 +55,15 @@ def myFunctionBar(
5555
): # Used in test, pylint: disable=invalid-name,unused-argument
5656
"""Test function at entry point myFunctionBar.
5757
58-
Loaded in a test which verifies entry point handling in a file with multiple
59-
entry points.
58+
Loaded in a test which verifies entry point handling in a file with multiple
59+
entry points.
6060
61-
Args:
62-
event: The event data (as dictionary) which triggered this background
63-
function. Must contain entries for 'value' and 'filename' keys in the data
64-
dictionary.
65-
context (google.cloud.functions.Context): The Cloud Functions event context.
66-
"""
61+
Args:
62+
event: The event data (as dictionary) which triggered this background
63+
function. Must contain entries for 'value' and 'filename' keys in the data
64+
dictionary.
65+
context (google.cloud.functions.Context): The Cloud Functions event context.
66+
"""
6767
fun("myFunctionBar", event)
6868

6969

tests/test_functions/background_trigger/main.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ def function(
2020
): # Required by function definition pylint: disable=unused-argument
2121
"""Test background function.
2222
23-
It writes the expected output (entry point name and the given value) to the
24-
given file, as a response from the background function, verified by the test.
23+
It writes the expected output (entry point name and the given value) to the
24+
given file, as a response from the background function, verified by the test.
2525
26-
Args:
27-
event: The event data (as dictionary) which triggered this background
28-
function. Must contain entries for 'value' and 'filename' keys in the
29-
data dictionary.
30-
context (google.cloud.functions.Context): The Cloud Functions event context.
31-
"""
26+
Args:
27+
event: The event data (as dictionary) which triggered this background
28+
function. Must contain entries for 'value' and 'filename' keys in the
29+
data dictionary.
30+
context (google.cloud.functions.Context): The Cloud Functions event context.
31+
"""
3232
filename = event["filename"]
3333
value = event["value"]
3434
f = open(filename, "w")

tests/test_functions/cloudevents/main.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919
def function(cloudevent):
2020
"""Test Event function that checks to see if a valid CloudEvent was sent.
2121
22-
The function returns 200 if it received the expected event, otherwise 500.
22+
The function returns 200 if it received the expected event, otherwise 500.
2323
24-
Args:
25-
cloudevent: A Cloud event as defined by https://github.com/cloudevents/sdk-python.
24+
Args:
25+
cloudevent: A Cloud event as defined by https://github.com/cloudevents/sdk-python.
2626
27-
Returns:
28-
HTTP status code indicating whether valid event was sent or not.
27+
Returns:
28+
HTTP status code indicating whether valid event was sent or not.
2929
30-
"""
30+
"""
3131
valid_event = (
3232
cloudevent.EventID() == "my-id"
3333
and cloudevent.Data() == '{"name":"john"}'

tests/test_functions/http_check_env/main.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
def function(request):
2424
"""Test function which returns the requested environment variable value.
2525
26-
Args:
27-
request: The HTTP request which triggered this function. Must contain name
28-
of the requested environment variable in the 'mode' field in JSON document
29-
in request body.
26+
Args:
27+
request: The HTTP request which triggered this function. Must contain name
28+
of the requested environment variable in the 'mode' field in JSON document
29+
in request body.
3030
31-
Returns:
32-
Value of the requested environment variable.
33-
"""
31+
Returns:
32+
Value of the requested environment variable.
33+
"""
3434
name = request.get_json().get("mode")
3535
return os.environ[name]

tests/test_functions/http_flask_render_template/main.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,20 @@
2020
def function(request):
2121
"""Test HTTP function whose behavior depends on the given mode.
2222
23-
The function returns a success, a failure, or throws an exception, depending
24-
on the given mode.
23+
The function returns a success, a failure, or throws an exception, depending
24+
on the given mode.
2525
26-
Args:
27-
request: The HTTP request which triggered this function. Must contain name
28-
of the requested mode in the 'mode' field in JSON document in request
29-
body.
26+
Args:
27+
request: The HTTP request which triggered this function. Must contain name
28+
of the requested mode in the 'mode' field in JSON document in request
29+
body.
3030
31-
Returns:
32-
Value and status code defined for the given mode.
31+
Returns:
32+
Value and status code defined for the given mode.
3333
34-
Raises:
35-
Exception: Thrown when requested in the incoming mode specification.
36-
"""
34+
Raises:
35+
Exception: Thrown when requested in the incoming mode specification.
36+
"""
3737
if request.args and "message" in request.args:
3838
message = request.args.get("message")
3939
elif request.get_json() and "message" in request.get_json():

tests/test_functions/http_method_check/main.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
def function(request):
1919
"""Test HTTP function which returns the method it was called with
2020
21-
Args:
22-
request: The HTTP request which triggered this function.
21+
Args:
22+
request: The HTTP request which triggered this function.
2323
24-
Returns:
25-
The HTTP method which was used to call this function
26-
"""
24+
Returns:
25+
The HTTP method which was used to call this function
26+
"""
2727
return request.method

tests/test_functions/http_request_check/main.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@
1818
def function(request):
1919
"""Test function which returns the requested element of the HTTP request.
2020
21-
Name of the requested HTTP request element is provided in the 'mode' field in
22-
the incoming JSON document.
21+
Name of the requested HTTP request element is provided in the 'mode' field in
22+
the incoming JSON document.
2323
24-
Args:
25-
request: The HTTP request which triggered this function. Must contain name
26-
of the requested HTTP request element in the 'mode' field in JSON document
27-
in request body.
24+
Args:
25+
request: The HTTP request which triggered this function. Must contain name
26+
of the requested HTTP request element in the 'mode' field in JSON document
27+
in request body.
2828
29-
Returns:
30-
Value of the requested HTTP request element, or 'Bad Request' status in case
31-
of unrecognized incoming request.
32-
"""
29+
Returns:
30+
Value of the requested HTTP request element, or 'Bad Request' status in case
31+
of unrecognized incoming request.
32+
"""
3333
mode = request.get_json().get("mode")
3434
if mode == "path":
3535
return request.path

tests/test_functions/http_trigger/main.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,20 @@
2020
def function(request):
2121
"""Test HTTP function whose behavior depends on the given mode.
2222
23-
The function returns a success, a failure, or throws an exception, depending
24-
on the given mode.
23+
The function returns a success, a failure, or throws an exception, depending
24+
on the given mode.
2525
26-
Args:
27-
request: The HTTP request which triggered this function. Must contain name
28-
of the requested mode in the 'mode' field in JSON document in request
29-
body.
26+
Args:
27+
request: The HTTP request which triggered this function. Must contain name
28+
of the requested mode in the 'mode' field in JSON document in request
29+
body.
3030
31-
Returns:
32-
Value and status code defined for the given mode.
31+
Returns:
32+
Value and status code defined for the given mode.
3333
34-
Raises:
35-
Exception: Thrown when requested in the incoming mode specification.
36-
"""
34+
Raises:
35+
Exception: Thrown when requested in the incoming mode specification.
36+
"""
3737
mode = request.get_json().get("mode")
3838
print("Mode: " + mode) # pylint: disable=superfluous-parens
3939
if mode == "SUCCESS":

0 commit comments

Comments
 (0)