|
4 | 4 | import numpy as np
|
5 | 5 | import pandas as pd
|
6 | 6 |
|
| 7 | +from pandas.compat import long |
| 8 | + |
7 | 9 |
|
8 | 10 | @pytest.fixture(params=[1, np.array(1, dtype=np.int64)])
|
9 | 11 | def one(request):
|
10 | 12 | # zero-dim integer array behaves like an integer
|
11 | 13 | return request.param
|
12 | 14 |
|
13 | 15 |
|
| 16 | +zeros = [box_cls([0] * 5, dtype=dtype) |
| 17 | + for box_cls in [pd.Index, np.array] |
| 18 | + for dtype in [np.int64, np.uint64, np.float64]] |
| 19 | +zeros.extend([np.array(0, dtype=dtype) |
| 20 | + for dtype in [np.int64, np.uint64, np.float64]]) |
| 21 | +zeros.extend([0, 0.0, long(0)]) |
| 22 | + |
| 23 | + |
| 24 | +@pytest.fixture(params=zeros) |
| 25 | +def zero(request): |
| 26 | + # For testing division by (or of) zero for Index with length 5, this |
| 27 | + # gives several scalar-zeros and length-5 vector-zeros |
| 28 | + return request.param |
| 29 | + |
| 30 | + |
| 31 | +@pytest.fixture(params=[pd.Float64Index(np.arange(5, dtype='float64')), |
| 32 | + pd.Int64Index(np.arange(5, dtype='int64')), |
| 33 | + pd.UInt64Index(np.arange(5, dtype='uint64'))], |
| 34 | + ids=lambda x: type(x).__name__) |
| 35 | +def idx(request): |
| 36 | + return request.param |
| 37 | + |
| 38 | + |
| 39 | +@pytest.fixture(params=[pd.Timedelta('5m4s').to_pytimedelta(), |
| 40 | + pd.Timedelta('5m4s'), |
| 41 | + pd.Timedelta('5m4s').to_timedelta64()], |
| 42 | + ids=lambda x: type(x).__name__) |
| 43 | +def scalar_td(request): |
| 44 | + """ |
| 45 | + Several variants of Timedelta scalars representing 5 minutes and 4 seconds |
| 46 | + """ |
| 47 | + return request.param |
| 48 | + |
| 49 | + |
14 | 50 | # ------------------------------------------------------------------
|
15 | 51 |
|
16 | 52 | @pytest.fixture(params=[pd.Index, pd.Series, pd.DataFrame],
|
|
0 commit comments