Skip to content

Commit

Permalink
🦉 Updates from OwlBot post-processor
Browse files Browse the repository at this point in the history
  • Loading branch information
gcf-owl-bot[bot] committed Dec 10, 2024
1 parent 9b53801 commit a9b1755
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 1 addition & 3 deletions pandas_gbq/gbq.py
Original file line number Diff line number Diff line change
Expand Up @@ -1097,9 +1097,7 @@ def to_gbq(
# fail early if there are bigframes-y methods available.
# https://github.com/googleapis/python-bigquery-pandas/issues/824
if hasattr(dataframe, "to_pandas") and hasattr(dataframe, "to_gbq"):
raise TypeError(
f"Expected a pandas.DataFrame, but got {repr(type(dataframe))}"
)
raise TypeError(f"Expected a pandas.DataFrame, but got {repr(type(dataframe))}")

_test_google_api_imports()

Expand Down
5 changes: 2 additions & 3 deletions tests/unit/test_to_gbq.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class FakeDataFrame:

def to_gbq(self):
"""Fake to_gbq() to mimic a bigframes object."""

def to_pandas(self):
"""Fake to_pandas() to mimic a bigframes object."""

Expand Down Expand Up @@ -80,8 +80,7 @@ def test_to_gbq_with_bigframes_raises_typeerror():
dataframe = FakeDataFrame()

with pytest.raises(
TypeError,
match=r"Expected a pandas.DataFrame, but got .+FakeDataFrame"
TypeError, match=r"Expected a pandas.DataFrame, but got .+FakeDataFrame"
):
gbq.to_gbq(dataframe, "my_dataset.my_table", project_id="myproj")

Expand Down

0 comments on commit a9b1755

Please sign in to comment.