Skip to content

Commit 52258c4

Browse files
committed
Update test_timedeltas.py
Add test for pandas-dev#12136
1 parent 8f25349 commit 52258c4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pandas/tseries/tests/test_timedeltas.py

+9
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,15 @@ def conv(v):
726726
expected = TimedeltaIndex([np.timedelta64(1, 'D')] * 5)
727727
tm.assert_index_equal(result, expected)
728728

729+
# Test with bare strings
730+
expected = pd.to_timedelta(6458920, unit='s')
731+
result = pd.to_timedelta('6458920', unit='s')
732+
self.assertEqual(result, expected)
733+
734+
# And arrays of strings
735+
result = pd.to_timedelta(['6458920'], unit='s')[0]
736+
self.assertEqual(result, expected)
737+
729738
# Test with lists as input when box=false
730739
expected = np.array(np.arange(3) * 1000000000, dtype='timedelta64[ns]')
731740
result = to_timedelta(range(3), unit='s', box=False)

0 commit comments

Comments
 (0)