Skip to content

Commit d2e2b7a

Browse files
fix: Address PR feedback
- Correct the copyright year in `tests/unit/functions/test_function_typing.py` to 2024. - Restructure the tests in `tests/unit/functions/test_function_typing.py` to improve readability by adding empty lines between the "arrange," "act," and "assert" blocks.
1 parent 96be4b0 commit d2e2b7a

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

tests/unit/functions/test_function_typing.py

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2025 Google LLC
1+
# Copyright 2024 Google LLC
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -21,21 +21,37 @@
2121

2222

2323
def test_unsupported_type_error_init_with_dict():
24-
err = function_typing.UnsupportedTypeError(
25-
decimal.Decimal, {int: "INT64", float: "FLOAT64"}
26-
)
24+
# Arrange
25+
unsupported_type = decimal.Decimal
26+
supported_types = {int: "INT64", float: "FLOAT64"}
27+
28+
# Act
29+
err = function_typing.UnsupportedTypeError(unsupported_type, supported_types)
30+
31+
# Assert
2732
assert "Decimal" in str(err)
2833
assert "float, int" in str(err)
2934

3035

3136
def test_unsupported_type_error_init_with_set():
32-
err = function_typing.UnsupportedTypeError(decimal.Decimal, {int, float})
37+
# Arrange
38+
unsupported_type = decimal.Decimal
39+
supported_types = {int, float}
40+
41+
# Act
42+
err = function_typing.UnsupportedTypeError(unsupported_type, supported_types)
43+
44+
# Assert
3345
assert "Decimal" in str(err)
3446
assert "float, int" in str(err)
3547

3648

3749
def test_sdk_type_from_python_type_raises_unsupported_type_error():
50+
# Arrange
51+
unsupported_type = datetime.datetime
52+
53+
# Act & Assert
3854
with pytest.raises(function_typing.UnsupportedTypeError) as excinfo:
39-
function_typing.sdk_type_from_python_type(datetime.datetime)
55+
function_typing.sdk_type_from_python_type(unsupported_type)
4056
assert "datetime" in str(excinfo.value)
4157
assert "bool, bytes, float, int, str" in str(excinfo.value)

0 commit comments

Comments
 (0)