Skip to content

Commit

Permalink
BUG: Fix TimeDelta to Timedelta (#13600)
Browse files Browse the repository at this point in the history
  • Loading branch information
yui-knk authored and jreback committed Jul 9, 2016
1 parent ba82b51 commit f95576b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pandas/tseries/tests/test_timedeltas.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,12 @@ def test_construction(self):
self.assertRaises(ValueError, lambda: Timedelta('3.1415'))

# invalid construction
tm.assertRaisesRegexp(ValueError, "cannot construct a TimeDelta",
tm.assertRaisesRegexp(ValueError, "cannot construct a Timedelta",
lambda: Timedelta())
tm.assertRaisesRegexp(ValueError, "unit abbreviation w/o a number",
lambda: Timedelta('foo'))
tm.assertRaisesRegexp(ValueError,
"cannot construct a TimeDelta from the passed "
"cannot construct a Timedelta from the passed "
"arguments, allowed keywords are ",
lambda: Timedelta(day=10))

Expand Down
4 changes: 2 additions & 2 deletions pandas/tslib.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2615,7 +2615,7 @@ class Timedelta(_Timedelta):

if value is None:
if not len(kwargs):
raise ValueError("cannot construct a TimeDelta without a value/unit or descriptive keywords (days,seconds....)")
raise ValueError("cannot construct a Timedelta without a value/unit or descriptive keywords (days,seconds....)")

def _to_py_int_float(v):
if is_integer_object(v):
Expand All @@ -2630,7 +2630,7 @@ class Timedelta(_Timedelta):
nano = kwargs.pop('nanoseconds',0)
value = convert_to_timedelta64(timedelta(**kwargs),'ns',False) + nano
except TypeError as e:
raise ValueError("cannot construct a TimeDelta from the passed arguments, allowed keywords are "
raise ValueError("cannot construct a Timedelta from the passed arguments, allowed keywords are "
"[weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds]")

if isinstance(value, Timedelta):
Expand Down

0 comments on commit f95576b

Please sign in to comment.