Skip to content

TST: suppress some warnings #15932

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions pandas/core/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
intended for public consumption
"""
from __future__ import division
from warnings import warn
from warnings import warn, catch_warnings
import numpy as np

from pandas import compat, _np_version_under1p8
Expand Down Expand Up @@ -110,7 +110,11 @@ def _ensure_data(values, dtype=None):
values = _ensure_uint64(values)
ndtype = dtype = 'uint64'
elif is_complex_dtype(values) or is_complex_dtype(dtype):
values = _ensure_float64(values)

# ignore the fact that we are casting to float
# which discards complex parts
with catch_warnings(record=True):
values = _ensure_float64(values)
ndtype = dtype = 'float64'
elif is_float_dtype(values) or is_float_dtype(dtype):
values = _ensure_float64(values)
Expand Down
10 changes: 6 additions & 4 deletions pandas/tests/test_errors.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-

import pytest
from warnings import catch_warnings
import pandas # noqa
import pandas as pd

Expand Down Expand Up @@ -44,7 +45,8 @@ def test_error_rename():
except CParserError:
pass

try:
raise ParserError()
except pd.parser.CParserError:
pass
with catch_warnings(record=True):
try:
raise ParserError()
except pd.parser.CParserError:
pass