This repository was archived by the owner on Apr 1, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 68
feat: improve UnsupportedTypeError message
#2203
Closed
Closed
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c3247d5
feat: Improve `UnsupportedTypeError` message
google-labs-jules[bot] 1e3d74d
Apply suggestion from @tswast
tswast ea7e8bb
Merge branch 'main' into fix-unsupported-type-error-message
tswast 055b45e
fix: Handle generic types in UnsupportedTypeError
google-labs-jules[bot] 7f4eebb
Merge branch 'main' into fix-unsupported-type-error-message
tswast 3ad2f9a
fix: Handle generic types in UnsupportedTypeError
google-labs-jules[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # Copyright 2025 Google LLC | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| import datetime | ||
| import decimal | ||
|
|
||
| import pytest | ||
|
|
||
| from bigframes.functions import function_typing | ||
|
|
||
|
|
||
| def test_unsupported_type_error_init_with_dict(): | ||
| err = function_typing.UnsupportedTypeError( | ||
| decimal.Decimal, {int: "INT64", float: "FLOAT64"} | ||
| ) | ||
| assert "Decimal" in str(err) | ||
| assert "float, int" in str(err) | ||
|
|
||
|
|
||
| def test_unsupported_type_error_init_with_set(): | ||
| err = function_typing.UnsupportedTypeError(decimal.Decimal, {int, float}) | ||
| assert "Decimal" in str(err) | ||
| assert "float, int" in str(err) | ||
|
|
||
|
|
||
| def test_sdk_type_from_python_type_raises_unsupported_type_error(): | ||
| with pytest.raises(function_typing.UnsupportedTypeError) as excinfo: | ||
| function_typing.sdk_type_from_python_type(datetime.datetime) | ||
| assert "datetime" in str(excinfo.value) | ||
| assert "bool, bytes, float, int, str" in str(excinfo.value) | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
nit: insert empty lines between "arrange" "act" "assert" blocks: go/unit-testing-practices?polyglot=python#structure
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.
@google-labs-jules please address this nit: insert empty lines between "arrange" "act" "assert" blocks: go/unit-testing-practices?polyglot=python#structure
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.
Done! I've restructured the tests to improve readability.