redid lost changes to cast.py and test_cast.py · pandas-dev/pandas@7ad1e7d (original) (raw)

`@@ -9,7 +9,7 @@

`

9

9

`from datetime import datetime, timedelta, date

`

10

10

`import numpy as np

`

11

11

``

12

``

`-

from pandas import Timedelta, Timestamp, DatetimeIndex

`

``

12

`+

from pandas import Timedelta, Timestamp, DatetimeIndex, DataFrame, NaT

`

13

13

``

14

14

`from pandas.core.dtypes.cast import (

`

15

15

`maybe_downcast_to_dtype,

`

`@@ -213,6 +213,17 @@ def test_maybe_convert_scalar(self):

`

213

213

`result = maybe_convert_scalar(Timedelta('1 day 1 min'))

`

214

214

`assert result == Timedelta('1 day 1 min').value

`

215

215

``

``

216

`+

def test_maybe_infer_to_datetimelike(self):

`

``

217

`+

GH16362

`

``

218

`+

pandas=0.20.1 raises IndexError: tuple index out of range

`

``

219

`+

result = DataFrame(np.array([[NaT, 'a', 'b', 0],

`

``

220

`+

[NaT, 'b', 'c', 1]]))

`

``

221

`+

assert result.size == 8

`

``

222

`+

this construction was fine

`

``

223

`+

result = DataFrame(np.array([[NaT, 'a', 0],

`

``

224

`+

[NaT, 'b', 1]]))

`

``

225

`+

assert result.size == 6

`

``

226

+

216

227

``

217

228

`class TestConvert(object):

`

218

229

``