Skip to content

Commit f723be4

Browse files
committed
ns instead of units for some tests
1 parent 5987b95 commit f723be4

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

pandas/tests/indexes/datetimes/test_tools.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -391,10 +391,10 @@ def test_unit_with_numeric(self):
391391
arr1 = [1.434692e+18, 1.432766e+18]
392392
arr2 = np.array(arr1).astype('int64')
393393
for errors in ['ignore', 'raise', 'coerce']:
394-
result = pd.to_datetime(arr1, unit=units, errors=errors)
394+
result = pd.to_datetime(arr1, unit='ns', errors=errors)
395395
self.assert_index_equal(result, expected)
396396

397-
result = pd.to_datetime(arr2, unit=units, errors=errors)
397+
result = pd.to_datetime(arr2, unit='ns', errors=errors)
398398
self.assert_index_equal(result, expected)
399399

400400
# but we want to make sure that we are coercing
@@ -403,15 +403,15 @@ def test_unit_with_numeric(self):
403403
'2015-06-19 05:33:20',
404404
'2015-05-27 22:33:20'])
405405
arr = ['foo', 1.434692e+18, 1.432766e+18]
406-
result = pd.to_datetime(arr, unit=units, errors='coerce')
406+
result = pd.to_datetime(arr, unit='ns', errors='coerce')
407407
self.assert_index_equal(result, expected)
408408

409409
expected = DatetimeIndex(['2015-06-19 05:33:20',
410410
'2015-05-27 22:33:20',
411411
'NaT',
412412
'NaT'])
413413
arr = [1.434692e+18, 1.432766e+18, 'foo', 'NaT']
414-
result = pd.to_datetime(arr, unit=units, errors='coerce')
414+
result = pd.to_datetime(arr, unit='ns', errors='coerce')
415415
self.assert_index_equal(result, expected)
416416

417417
def test_unit_mixed(self):
@@ -423,17 +423,17 @@ def test_unit_mixed(self):
423423
self.assert_index_equal(result, expected)
424424

425425
with self.assertRaises(ValueError):
426-
pd.to_datetime(arr, unit=units, errors='raise')
426+
pd.to_datetime(arr, unit='ns', errors='raise')
427427

428428
expected = DatetimeIndex(['NaT',
429429
'NaT',
430430
'2013-01-01'])
431431
arr = [1.434692e+18, 1.432766e+18, pd.Timestamp('20130101')]
432-
result = pd.to_datetime(arr, unit=units, errors='coerce')
432+
result = pd.to_datetime(arr, unit='ns', errors='coerce')
433433
self.assert_index_equal(result, expected)
434434

435435
with self.assertRaises(ValueError):
436-
pd.to_datetime(arr, unit=units, errors='raise')
436+
pd.to_datetime(arr, unit='ns', errors='raise')
437437

438438
def test_dataframe(self):
439439

0 commit comments

Comments
 (0)