Skip to content

Commit

Permalink
Fix unit test. Blacken
Browse files Browse the repository at this point in the history
  • Loading branch information
tswast committed Apr 3, 2019
1 parent 7db8b1f commit b933dfc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
4 changes: 3 additions & 1 deletion tests/system/test_gbq.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,9 @@ def test_should_properly_handle_timestamp_unix_epoch(self, project_id):
dtype="datetime64[ns]",
)
if expected["unix_epoch"].dt.tz is None:
expected["unix_epoch"] = expected["unix_epoch"].dt.tz_localize("UTC")
expected["unix_epoch"] = expected["unix_epoch"].dt.tz_localize(
"UTC"
)
tm.assert_frame_equal(df, expected)

def test_should_properly_handle_arbitrary_timestamp(self, project_id):
Expand Down
12 changes: 2 additions & 10 deletions tests/unit/test_gbq.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ def no_auth(monkeypatch):
("INTEGER", None), # Can't handle NULL
("BOOLEAN", None), # Can't handle NULL
("FLOAT", numpy.dtype(float)),
# TIMESTAMP will be localized after DataFrame construction.
("TIMESTAMP", "datetime64[ns]"),
("DATETIME", "datetime64[ns]"),
],
)
Expand All @@ -108,16 +110,6 @@ def test_should_return_bigquery_correctly_typed(type_, expected):
assert result == {"x": expected}


def test_should_return_bigquery_correctly_typed_timestamp():
result = gbq._bqschema_to_nullsafe_dtypes(
[dict(name="x", type="TIMESTAMP", mode="NULLABLE")]
)
if pandas_installed_version < pkg_resources.parse_version("0.24.0"):
assert result == {"x": "datetime64[ns]"}
else:
assert result == {"x": "datetime64[ns, UTC]"}


def test_to_gbq_should_fail_if_invalid_table_name_passed():
with pytest.raises(gbq.NotFoundException):
gbq.to_gbq(DataFrame([[1]]), "invalid_table_name", project_id="1234")
Expand Down

0 comments on commit b933dfc

Please sign in to comment.