Skip to content

Commit 4fc475d

Browse files
author
Matti Remes
committed
fix tests by using pytest raise asserts
1 parent 6740634 commit 4fc475d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pandas_gbq/tests/test_gbq.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# -*- coding: utf-8 -*-
22

33
import pytest
4+
import warnings
45

56
import re
67
from datetime import datetime
@@ -174,7 +175,7 @@ def make_mixed_dataframe_v2(test_size):
174175

175176
def test_generate_bq_schema_deprecated():
176177
# 11121 Deprecation of generate_bq_schema
177-
with tm.assert_produces_warning(FutureWarning):
178+
with pytest.warns(FutureWarning):
178179
df = make_mixed_dataframe_v2(10)
179180
gbq.generate_bq_schema(df)
180181

@@ -1447,7 +1448,7 @@ def test_upload_data_with_invalid_user_schema_raises_error(self):
14471448
{'name': 'C', 'type': 'FLOAT'},
14481449
{'name': 'D', 'type': 'FLOAT'}]
14491450
destination_table = self.destination_table + test_id
1450-
with tm.assertRaises(gbq.GenericGBQException):
1451+
with pytest.raises(gbq.GenericGBQException):
14511452
gbq.to_gbq(df, destination_table, _get_project_id(),
14521453
private_key=_get_private_key_path(),
14531454
table_schema=test_schema)
@@ -1459,7 +1460,7 @@ def test_upload_data_with_missing_schema_fields_raises_error(self):
14591460
{'name': 'B', 'type': 'FLOAT'},
14601461
{'name': 'C', 'type': 'FLOAT'}]
14611462
destination_table = self.destination_table + test_id
1462-
with tm.assertRaises(gbq.GenericGBQException):
1463+
with pytest.raises(gbq.GenericGBQException):
14631464
gbq.to_gbq(df, destination_table, _get_project_id(),
14641465
private_key=_get_private_key_path(),
14651466
table_schema=test_schema)

0 commit comments

Comments
 (0)