Skip to content

Commit f3d794d

Browse files
committed
Parametrize test as suggested on review
1 parent af64016 commit f3d794d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

python/pyarrow/tests/test_pandas.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -448,11 +448,12 @@ def test_string_column_index(self):
448448
assert len(md) == 1
449449
assert md['encoding'] == 'UTF-8'
450450

451-
def test_datetimetz_column_index(self):
451+
@pytest.mark.parametrize('unit', ['us', 'ns'])
452+
def test_datetimetz_column_index(self, unit):
452453
df = pd.DataFrame(
453454
[(1, 'a', 2.0), (2, 'b', 3.0), (3, 'c', 4.0)],
454455
columns=pd.date_range(
455-
start='2017-01-01', periods=3, tz='America/New_York', unit='us'
456+
start='2017-01-01', periods=3, tz='America/New_York', unit=unit
456457
)
457458
)
458459
t = pa.Table.from_pandas(df, preserve_index=True)
@@ -461,7 +462,7 @@ def test_datetimetz_column_index(self):
461462
column_indexes, = js['column_indexes']
462463
assert column_indexes['name'] is None
463464
assert column_indexes['pandas_type'] == 'datetimetz'
464-
assert column_indexes['numpy_type'] == 'datetime64[us]'
465+
assert column_indexes['numpy_type'] == f'datetime64[{unit}]'
465466

466467
md = column_indexes['metadata']
467468
assert md['timezone'] == 'America/New_York'

0 commit comments

Comments
 (0)