Skip to content

Commit 504c2a2

Browse files
committed
Fix tests that weren't run by PyCharm
1 parent 23c133d commit 504c2a2

File tree

4 files changed

+14
-17
lines changed

4 files changed

+14
-17
lines changed

pandas/tseries/tests/test_converter.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import nose
44

55
import numpy as np
6-
from pandas import Timestamp, Period
6+
from pandas import Timestamp, Period, Index
77
from pandas.compat import u
88
import pandas.util.testing as tm
99
from pandas.tseries.offsets import Second, Milli, Micro
@@ -104,7 +104,7 @@ def test_dateindex_conversion(self):
104104
for freq in ('B', 'L', 'S'):
105105
dateindex = tm.makeDateIndex(k=10, freq=freq)
106106
rs = self.dtc.convert(dateindex, None, None)
107-
xp = converter.dates.date2num(dateindex._mpl_repr())
107+
xp = Index(converter.dates.date2num(dateindex._mpl_repr()))
108108
tm.assert_almost_equal(rs, xp, decimals)
109109

110110
def test_resolution(self):

pandas/tseries/tests/test_period.py

+6-9
Original file line numberDiff line numberDiff line change
@@ -3521,8 +3521,8 @@ def test_map(self):
35213521
tm.assert_index_equal(result, expected)
35223522

35233523
result = index.map(lambda x: x.ordinal)
3524-
exp = np.array([x.ordinal for x in index], dtype=np.int64)
3525-
tm.assert_numpy_array_equal(result, exp)
3524+
exp = Index([x.ordinal for x in index])
3525+
tm.assert_index_equal(result, exp)
35263526

35273527
def test_map_with_string_constructor(self):
35283528
raw = [2005, 2007, 2009]
@@ -3534,20 +3534,17 @@ def test_map_with_string_constructor(self):
35343534
types += text_type,
35353535

35363536
for t in types:
3537-
expected = np.array(lmap(t, raw), dtype=object)
3537+
expected = Index(lmap(t, raw))
35383538
res = index.map(t)
35393539

3540-
# should return an array
3541-
tm.assertIsInstance(res, np.ndarray)
3540+
# should return an Index
3541+
tm.assertIsInstance(res, Index)
35423542

35433543
# preserve element types
35443544
self.assertTrue(all(isinstance(resi, t) for resi in res))
35453545

3546-
# dtype should be object
3547-
self.assertEqual(res.dtype, np.dtype('object').type)
3548-
35493546
# lastly, values should compare equal
3550-
tm.assert_numpy_array_equal(res, expected)
3547+
tm.assert_index_equal(res, expected)
35513548

35523549
def test_convert_array_of_periods(self):
35533550
rng = period_range('1/1/2000', periods=20, freq='D')

pandas/tseries/tests/test_timedeltas.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1513,8 +1513,8 @@ def test_map(self):
15131513

15141514
f = lambda x: x.days
15151515
result = rng.map(f)
1516-
exp = np.array([f(x) for x in rng], dtype=np.int64)
1517-
self.assert_numpy_array_equal(result, exp)
1516+
exp = Int64Index([f(x) for x in rng])
1517+
self.assert_index_equal(result, exp)
15181518

15191519
def test_misc_coverage(self):
15201520

pandas/tseries/tests/test_timeseries.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -3003,8 +3003,8 @@ def test_map(self):
30033003

30043004
f = lambda x: x.strftime('%Y%m%d')
30053005
result = rng.map(f)
3006-
exp = np.array([f(x) for x in rng], dtype='=U8')
3007-
tm.assert_almost_equal(result, exp)
3006+
exp = Index([f(x) for x in rng], dtype='<U8')
3007+
tm.assert_index_equal(result, exp)
30083008

30093009
def test_iteration_preserves_tz(self):
30103010

@@ -3700,8 +3700,8 @@ def test_map_bug_1677(self):
37003700
f = index.asof
37013701

37023702
result = index.map(f)
3703-
expected = np.array([f(index[0])])
3704-
self.assert_numpy_array_equal(result, expected)
3703+
expected = Index([f(index[0])])
3704+
self.assert_index_equal(result, expected)
37053705

37063706
def test_groupby_function_tuple_1677(self):
37073707
df = DataFrame(np.random.rand(100),

0 commit comments

Comments
 (0)