99def test_is_monotonic_increasing ():
1010 i = MultiIndex .from_product ([np .arange (10 ),
1111 np .arange (10 )], names = ['one' , 'two' ])
12- assert i .is_monotonic
13- assert i ._is_strictly_monotonic_increasing
14- assert Index (i .values ).is_monotonic
15- assert i ._is_strictly_monotonic_increasing
12+ assert i .is_monotonic is True
13+ assert i ._is_strictly_monotonic_increasing is True
14+ assert Index (i .values ).is_monotonic is True
15+ assert i ._is_strictly_monotonic_increasing is True
1616
1717 i = MultiIndex .from_product ([np .arange (10 , 0 , - 1 ),
1818 np .arange (10 )], names = ['one' , 'two' ])
19- assert not i .is_monotonic
20- assert not i ._is_strictly_monotonic_increasing
21- assert not Index (i .values ).is_monotonic
22- assert not Index (i .values )._is_strictly_monotonic_increasing
19+ assert i .is_monotonic is False
20+ assert i ._is_strictly_monotonic_increasing is False
21+ assert Index (i .values ).is_monotonic is False
22+ assert Index (i .values )._is_strictly_monotonic_increasing is False
2323
2424 i = MultiIndex .from_product ([np .arange (10 ),
2525 np .arange (10 , 0 , - 1 )],
2626 names = ['one' , 'two' ])
27- assert not i .is_monotonic
28- assert not i ._is_strictly_monotonic_increasing
29- assert not Index (i .values ).is_monotonic
30- assert not Index (i .values )._is_strictly_monotonic_increasing
27+ assert i .is_monotonic is False
28+ assert i ._is_strictly_monotonic_increasing is False
29+ assert Index (i .values ).is_monotonic is False
30+ assert Index (i .values )._is_strictly_monotonic_increasing is False
3131
3232 i = MultiIndex .from_product ([[1.0 , np .nan , 2.0 ], ['a' , 'b' , 'c' ]])
33- assert not i .is_monotonic
34- assert not i ._is_strictly_monotonic_increasing
35- assert not Index (i .values ).is_monotonic
36- assert not Index (i .values )._is_strictly_monotonic_increasing
33+ assert i .is_monotonic is False
34+ assert i ._is_strictly_monotonic_increasing is False
35+ assert Index (i .values ).is_monotonic is False
36+ assert Index (i .values )._is_strictly_monotonic_increasing is False
3737
3838 # string ordering
3939 i = MultiIndex (levels = [['foo' , 'bar' , 'baz' , 'qux' ],
4040 ['one' , 'two' , 'three' ]],
4141 labels = [[0 , 0 , 0 , 1 , 1 , 2 , 2 , 3 , 3 , 3 ],
4242 [0 , 1 , 2 , 0 , 1 , 1 , 2 , 0 , 1 , 2 ]],
4343 names = ['first' , 'second' ])
44- assert not i .is_monotonic
45- assert not Index (i .values ).is_monotonic
46- assert not i ._is_strictly_monotonic_increasing
47- assert not Index (i .values )._is_strictly_monotonic_increasing
44+ assert i .is_monotonic is False
45+ assert Index (i .values ).is_monotonic is False
46+ assert i ._is_strictly_monotonic_increasing is False
47+ assert Index (i .values )._is_strictly_monotonic_increasing is False
4848
4949 i = MultiIndex (levels = [['bar' , 'baz' , 'foo' , 'qux' ],
5050 ['mom' , 'next' , 'zenith' ]],
5151 labels = [[0 , 0 , 0 , 1 , 1 , 2 , 2 , 3 , 3 , 3 ],
5252 [0 , 1 , 2 , 0 , 1 , 1 , 2 , 0 , 1 , 2 ]],
5353 names = ['first' , 'second' ])
54- assert i .is_monotonic
55- assert Index (i .values ).is_monotonic
56- assert i ._is_strictly_monotonic_increasing
57- assert Index (i .values )._is_strictly_monotonic_increasing
54+ assert i .is_monotonic is True
55+ assert Index (i .values ).is_monotonic is True
56+ assert i ._is_strictly_monotonic_increasing is True
57+ assert Index (i .values )._is_strictly_monotonic_increasing is True
5858
5959 # mixed levels, hits the TypeError
6060 i = MultiIndex (
@@ -64,67 +64,67 @@ def test_is_monotonic_increasing():
6464 labels = [[0 , 1 , 1 , 2 , 2 , 2 , 3 ], [4 , 2 , 0 , 0 , 1 , 3 , - 1 ]],
6565 names = ['household_id' , 'asset_id' ])
6666
67- assert not i .is_monotonic
68- assert not i ._is_strictly_monotonic_increasing
67+ assert i .is_monotonic is False
68+ assert i ._is_strictly_monotonic_increasing is False
6969
7070 # empty
7171 i = MultiIndex .from_arrays ([[], []])
72- assert i .is_monotonic
73- assert Index (i .values ).is_monotonic
74- assert i ._is_strictly_monotonic_increasing
75- assert Index (i .values )._is_strictly_monotonic_increasing
72+ assert i .is_monotonic is True
73+ assert Index (i .values ).is_monotonic is True
74+ assert i ._is_strictly_monotonic_increasing is True
75+ assert Index (i .values )._is_strictly_monotonic_increasing is True
7676
7777
7878def test_is_monotonic_decreasing ():
7979 i = MultiIndex .from_product ([np .arange (9 , - 1 , - 1 ),
8080 np .arange (9 , - 1 , - 1 )],
8181 names = ['one' , 'two' ])
82- assert i .is_monotonic_decreasing
83- assert i ._is_strictly_monotonic_decreasing
84- assert Index (i .values ).is_monotonic_decreasing
85- assert i ._is_strictly_monotonic_decreasing
82+ assert i .is_monotonic_decreasing is True
83+ assert i ._is_strictly_monotonic_decreasing is True
84+ assert Index (i .values ).is_monotonic_decreasing is True
85+ assert i ._is_strictly_monotonic_decreasing is True
8686
8787 i = MultiIndex .from_product ([np .arange (10 ),
8888 np .arange (10 , 0 , - 1 )],
8989 names = ['one' , 'two' ])
90- assert not i .is_monotonic_decreasing
91- assert not i ._is_strictly_monotonic_decreasing
92- assert not Index (i .values ).is_monotonic_decreasing
93- assert not Index (i .values )._is_strictly_monotonic_decreasing
90+ assert i .is_monotonic_decreasing is False
91+ assert i ._is_strictly_monotonic_decreasing is False
92+ assert Index (i .values ).is_monotonic_decreasing is False
93+ assert Index (i .values )._is_strictly_monotonic_decreasing is False
9494
9595 i = MultiIndex .from_product ([np .arange (10 , 0 , - 1 ),
9696 np .arange (10 )], names = ['one' , 'two' ])
97- assert not i .is_monotonic_decreasing
98- assert not i ._is_strictly_monotonic_decreasing
99- assert not Index (i .values ).is_monotonic_decreasing
100- assert not Index (i .values )._is_strictly_monotonic_decreasing
97+ assert i .is_monotonic_decreasing is False
98+ assert i ._is_strictly_monotonic_decreasing is False
99+ assert Index (i .values ).is_monotonic_decreasing is False
100+ assert Index (i .values )._is_strictly_monotonic_decreasing is False
101101
102102 i = MultiIndex .from_product ([[2.0 , np .nan , 1.0 ], ['c' , 'b' , 'a' ]])
103- assert not i .is_monotonic_decreasing
104- assert not i ._is_strictly_monotonic_decreasing
105- assert not Index (i .values ).is_monotonic_decreasing
106- assert not Index (i .values )._is_strictly_monotonic_decreasing
103+ assert i .is_monotonic_decreasing is False
104+ assert i ._is_strictly_monotonic_decreasing is False
105+ assert Index (i .values ).is_monotonic_decreasing is False
106+ assert Index (i .values )._is_strictly_monotonic_decreasing is False
107107
108108 # string ordering
109109 i = MultiIndex (levels = [['qux' , 'foo' , 'baz' , 'bar' ],
110110 ['three' , 'two' , 'one' ]],
111111 labels = [[0 , 0 , 0 , 1 , 1 , 2 , 2 , 3 , 3 , 3 ],
112112 [0 , 1 , 2 , 0 , 1 , 1 , 2 , 0 , 1 , 2 ]],
113113 names = ['first' , 'second' ])
114- assert not i .is_monotonic_decreasing
115- assert not Index (i .values ).is_monotonic_decreasing
116- assert not i ._is_strictly_monotonic_decreasing
117- assert not Index (i .values )._is_strictly_monotonic_decreasing
114+ assert i .is_monotonic_decreasing is False
115+ assert Index (i .values ).is_monotonic_decreasing is False
116+ assert i ._is_strictly_monotonic_decreasing is False
117+ assert Index (i .values )._is_strictly_monotonic_decreasing is False
118118
119119 i = MultiIndex (levels = [['qux' , 'foo' , 'baz' , 'bar' ],
120120 ['zenith' , 'next' , 'mom' ]],
121121 labels = [[0 , 0 , 0 , 1 , 1 , 2 , 2 , 3 , 3 , 3 ],
122122 [0 , 1 , 2 , 0 , 1 , 1 , 2 , 0 , 1 , 2 ]],
123123 names = ['first' , 'second' ])
124- assert i .is_monotonic_decreasing
125- assert Index (i .values ).is_monotonic_decreasing
126- assert i ._is_strictly_monotonic_decreasing
127- assert Index (i .values )._is_strictly_monotonic_decreasing
124+ assert i .is_monotonic_decreasing is True
125+ assert Index (i .values ).is_monotonic_decreasing is True
126+ assert i ._is_strictly_monotonic_decreasing is True
127+ assert Index (i .values )._is_strictly_monotonic_decreasing is True
128128
129129 # mixed levels, hits the TypeError
130130 i = MultiIndex (
@@ -134,29 +134,29 @@ def test_is_monotonic_decreasing():
134134 labels = [[0 , 1 , 1 , 2 , 2 , 2 , 3 ], [4 , 2 , 0 , 0 , 1 , 3 , - 1 ]],
135135 names = ['household_id' , 'asset_id' ])
136136
137- assert not i .is_monotonic_decreasing
138- assert not i ._is_strictly_monotonic_decreasing
137+ assert i .is_monotonic_decreasing is False
138+ assert i ._is_strictly_monotonic_decreasing is False
139139
140140 # empty
141141 i = MultiIndex .from_arrays ([[], []])
142- assert i .is_monotonic_decreasing
143- assert Index (i .values ).is_monotonic_decreasing
144- assert i ._is_strictly_monotonic_decreasing
145- assert Index (i .values )._is_strictly_monotonic_decreasing
142+ assert i .is_monotonic_decreasing is True
143+ assert Index (i .values ).is_monotonic_decreasing is True
144+ assert i ._is_strictly_monotonic_decreasing is True
145+ assert Index (i .values )._is_strictly_monotonic_decreasing is True
146146
147147
148148def test_is_strictly_monotonic_increasing ():
149149 idx = pd .MultiIndex (levels = [['bar' , 'baz' ], ['mom' , 'next' ]],
150150 labels = [[0 , 0 , 1 , 1 ], [0 , 0 , 0 , 1 ]])
151- assert idx .is_monotonic_increasing
152- assert not idx ._is_strictly_monotonic_increasing
151+ assert idx .is_monotonic_increasing is True
152+ assert idx ._is_strictly_monotonic_increasing is False
153153
154154
155155def test_is_strictly_monotonic_decreasing ():
156156 idx = pd .MultiIndex (levels = [['baz' , 'bar' ], ['next' , 'mom' ]],
157157 labels = [[0 , 0 , 1 , 1 ], [0 , 0 , 0 , 1 ]])
158- assert idx .is_monotonic_decreasing
159- assert not idx ._is_strictly_monotonic_decreasing
158+ assert idx .is_monotonic_decreasing is True
159+ assert idx ._is_strictly_monotonic_decreasing is False
160160
161161
162162def test_searchsorted_monotonic (indices ):
0 commit comments