Skip to content

Commit 256b3bd

Browse files
committed
TST: windows fixes relatd to Index not-subclass-ndarray
1 parent 4950474 commit 256b3bd

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

pandas/tests/test_index.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,9 +1633,7 @@ def test_numeric_compat(self):
16331633
if not (_np_version_under1p7 or compat.PY3_2):
16341634
for f in [lambda : np.timedelta64(1, 'D').astype('m8[ns]') * pd.date_range('2000-01-01', periods=3),
16351635
lambda : pd.date_range('2000-01-01', periods=3) * np.timedelta64(1, 'D').astype('m8[ns]') ]:
1636-
tm.assertRaisesRegexp(TypeError,
1637-
"cannot perform multiplication with this index type",
1638-
f)
1636+
self.assertRaises(TypeError, f)
16391637

16401638
class TestPeriodIndex(Base, tm.TestCase):
16411639
_holder = PeriodIndex

pandas/tests/test_series.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5236,9 +5236,12 @@ def test_reindex(self):
52365236

52375237
identity = self.series.reindex(self.series.index)
52385238

5239-
# the older numpies / 3.2 call __array_inteface__ which we don't define
5240-
if not _np_version_under1p7 and not PY3_2:
5239+
# __array_interface__ is not defined for older numpies
5240+
# and on some pythons
5241+
try:
52415242
self.assertTrue(np.may_share_memory(self.series.index, identity.index))
5243+
except (AttributeError):
5244+
pass
52425245

52435246
self.assertTrue(identity.index.is_(self.series.index))
52445247
self.assertTrue(identity.index.identical(self.series.index))

pandas/tseries/index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def wrapper(self, other):
8888
other = DatetimeIndex(other)
8989
elif not isinstance(other, (np.ndarray, Index, ABCSeries)):
9090
other = _ensure_datetime64(other)
91-
result = func(other)
91+
result = func(np.asarray(other))
9292
result = _values_from_object(result)
9393

9494
if isinstance(other, Index):

pandas/tseries/tests/test_timeseries.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
import pandas.compat as compat
3535
import pandas.core.common as com
3636
from pandas import concat
37-
from pandas import _np_version_under1p7
37+
from pandas import _np_version_under1p7, _np_version_under1p8
3838

3939
from numpy.testing.decorators import slow
4040

@@ -705,7 +705,7 @@ def test_frame_add_datetime64_col_other_units(self):
705705
df = DataFrame({'ints': np.arange(n)}, index=np.arange(n))
706706
df[unit] = vals
707707

708-
ex_vals = to_datetime(vals.astype('O'))
708+
ex_vals = to_datetime(vals.astype('O')).values
709709

710710
self.assertEqual(df[unit].dtype, ns_dtype)
711711
self.assertTrue((df[unit].values == ex_vals).all())
@@ -721,7 +721,7 @@ def test_frame_add_datetime64_col_other_units(self):
721721
tmp = df.copy()
722722

723723
tmp['dates'] = vals
724-
ex_vals = to_datetime(vals.astype('O'))
724+
ex_vals = to_datetime(vals.astype('O')).values
725725

726726
self.assertTrue((tmp['dates'].values == ex_vals).all())
727727

@@ -2225,7 +2225,7 @@ def test_comparisons_nat(self):
22252225
np.datetime64('2014-06-01 00:00Z'),
22262226
np.datetime64('2014-07-01 00:00Z')])
22272227

2228-
if _np_version_under1p7:
2228+
if _np_version_under1p8:
22292229
# cannot test array because np.datetime('nat') returns today's date
22302230
cases = [(fidx1, fidx2), (didx1, didx2)]
22312231
else:

0 commit comments

Comments
 (0)