Skip to content

Commit 6a1de10

Browse files
committed
clarifies purpose and asert for two tests regarding old verbose arg
1 parent 4ebcee1 commit 6a1de10

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

pandas_gbq/gbq.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,7 +1461,7 @@ def create_user_agent(
14611461
Returns (str):
14621462
Customized user agent string.
14631463
1464-
Deprecation Warning:
1464+
Deprecation Warning:
14651465
In a future major release, the default delimiter will be changed to
14661466
a `/` in accordance with RFC9110.
14671467
"""
@@ -1472,8 +1472,9 @@ def create_user_agent(
14721472
else:
14731473
warnings.warn(
14741474
"In a future major release, the default delimiter will be "
1475-
"changed to a `/` in accordance with RFC9110",
1475+
"changed to a `/` in accordance with RFC9110.",
14761476
PendingDeprecationWarning,
1477+
stacklevel=2,
14771478
)
14781479
delimiter = "-"
14791480

tests/unit/test_gbq.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,14 @@ def test_read_gbq_wo_verbose_w_new_pandas_no_warnings(monkeypatch, recwarn):
635635
mock.PropertyMock(return_value=False),
636636
)
637637
gbq.read_gbq("SELECT 1", project_id="my-project", dialect="standard")
638-
assert len(recwarn) == 0
638+
# This test was intended to check for warnings about the deprecation of
639+
# the argument `verbose` (which was removed from gbq (~v0.4.0) and
640+
# pandas (~v0.23.0). This test should not fail upon seeing a
641+
# warning in regards to a pending deprecation related to rfc9110 delimiters.
642+
# TODO this and related tests have likely outlived their usefulness,
643+
# consider removing.
644+
for warning in recwarn.list:
645+
assert "delimiter" in str(warning.message)
639646

640647

641648
def test_read_gbq_with_old_bq_raises_importerror(monkeypatch):
@@ -660,7 +667,14 @@ def test_read_gbq_with_verbose_old_pandas_no_warnings(monkeypatch, recwarn):
660667
dialect="standard",
661668
verbose=True,
662669
)
663-
assert len(recwarn) == 0
670+
# This test was intended to check for warnings about the deprecation of
671+
# the argument `verbose` (which was removed from gbq (~v0.4.0) and
672+
# pandas (~v0.23.0). This test should not fail upon seeing a
673+
# warning in regards to a pending deprecation related to rfc9110 delimiters.
674+
# TODO this and related tests have likely outlived their usefulness,
675+
# consider removing.
676+
for warning in recwarn.list:
677+
assert "delimiter" in str(warning.message)
664678

665679

666680
def test_read_gbq_with_private_raises_notimplmentederror():

0 commit comments

Comments
 (0)