File tree 2 files changed +12
-6
lines changed
2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 3
3
intended for public consumption
4
4
"""
5
5
from __future__ import division
6
- from warnings import warn
6
+ from warnings import warn , catch_warnings
7
7
import numpy as np
8
8
9
9
from pandas import compat , _np_version_under1p8
@@ -110,7 +110,11 @@ def _ensure_data(values, dtype=None):
110
110
values = _ensure_uint64 (values )
111
111
ndtype = dtype = 'uint64'
112
112
elif is_complex_dtype (values ) or is_complex_dtype (dtype ):
113
- values = _ensure_float64 (values )
113
+
114
+ # ignore the fact that we are casting to float
115
+ # which discards complex parts
116
+ with catch_warnings (record = True ):
117
+ values = _ensure_float64 (values )
114
118
ndtype = dtype = 'float64'
115
119
elif is_float_dtype (values ) or is_float_dtype (dtype ):
116
120
values = _ensure_float64 (values )
Original file line number Diff line number Diff line change 1
1
# -*- coding: utf-8 -*-
2
2
3
3
import pytest
4
+ from warnings import catch_warnings
4
5
import pandas # noqa
5
6
import pandas as pd
6
7
@@ -44,7 +45,8 @@ def test_error_rename():
44
45
except CParserError :
45
46
pass
46
47
47
- try :
48
- raise ParserError ()
49
- except pd .parser .CParserError :
50
- pass
48
+ with catch_warnings (record = True ):
49
+ try :
50
+ raise ParserError ()
51
+ except pd .parser .CParserError :
52
+ pass
You can’t perform that action at this time.
0 commit comments