@@ -21,7 +21,24 @@ def id_func(x):
21
21
22
22
@pytest .fixture (params = [1 , np .array (1 , dtype = np .int64 )])
23
23
def one (request ):
24
- # zero-dim integer array behaves like an integer
24
+ """
25
+ Several variants of integer value 1. The zero-dim integer array
26
+ behaves like an integer.
27
+
28
+ This fixture can be used to check that datetimelike indexes handle
29
+ addition and subtraction of integers and zero-dimensional arrays
30
+ of integers.
31
+
32
+ Examples
33
+ --------
34
+ >>> dti = pd.date_range('2016-01-01', periods=2, freq='H')
35
+ >>> dti
36
+ DatetimeIndex(['2016-01-01 00:00:00', '2016-01-01 01:00:00'],
37
+ dtype='datetime64[ns]', freq='H')
38
+ >>> dti + one
39
+ DatetimeIndex(['2016-01-01 01:00:00', '2016-01-01 02:00:00'],
40
+ dtype='datetime64[ns]', freq='H')
41
+ """
25
42
return request .param
26
43
27
44
@@ -40,8 +57,21 @@ def one(request):
40
57
41
58
@pytest .fixture (params = zeros )
42
59
def zero (request ):
43
- # For testing division by (or of) zero for Index with length 5, this
44
- # gives several scalar-zeros and length-5 vector-zeros
60
+ """
61
+ Several types of scalar zeros and length 5 vectors of zeros.
62
+
63
+ This fixture can be used to check that numeric-dtype indexes handle
64
+ division by any zero numeric-dtype.
65
+
66
+ Uses vector of length 5 for broadcasting with `numeric_idx` fixture,
67
+ which creates numeric-dtype vectors also of length 5.
68
+
69
+ Examples
70
+ --------
71
+ >>> arr = pd.RangeIndex(5)
72
+ >>> arr / zeros
73
+ Float64Index([nan, inf, inf, inf, inf], dtype='float64')
74
+ """
45
75
return request .param
46
76
47
77
0 commit comments