Skip to content

Commit

Permalink
fix tests by using pytest raise asserts
Browse files Browse the repository at this point in the history
  • Loading branch information
Matti Remes committed Jan 27, 2018
1 parent 6740634 commit 4fc475d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pandas_gbq/tests/test_gbq.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-

import pytest
import warnings

import re
from datetime import datetime
Expand Down Expand Up @@ -174,7 +175,7 @@ def make_mixed_dataframe_v2(test_size):

def test_generate_bq_schema_deprecated():
# 11121 Deprecation of generate_bq_schema
with tm.assert_produces_warning(FutureWarning):
with pytest.warns(FutureWarning):
df = make_mixed_dataframe_v2(10)
gbq.generate_bq_schema(df)

Expand Down Expand Up @@ -1447,7 +1448,7 @@ def test_upload_data_with_invalid_user_schema_raises_error(self):
{'name': 'C', 'type': 'FLOAT'},
{'name': 'D', 'type': 'FLOAT'}]
destination_table = self.destination_table + test_id
with tm.assertRaises(gbq.GenericGBQException):
with pytest.raises(gbq.GenericGBQException):
gbq.to_gbq(df, destination_table, _get_project_id(),
private_key=_get_private_key_path(),
table_schema=test_schema)
Expand All @@ -1459,7 +1460,7 @@ def test_upload_data_with_missing_schema_fields_raises_error(self):
{'name': 'B', 'type': 'FLOAT'},
{'name': 'C', 'type': 'FLOAT'}]
destination_table = self.destination_table + test_id
with tm.assertRaises(gbq.GenericGBQException):
with pytest.raises(gbq.GenericGBQException):
gbq.to_gbq(df, destination_table, _get_project_id(),
private_key=_get_private_key_path(),
table_schema=test_schema)
Expand Down

0 comments on commit 4fc475d

Please sign in to comment.