@@ -133,24 +133,37 @@ def test_to_boolean_array_error(values):
133133 pd .array (values , dtype = "boolean" )
134134
135135
136- def test_to_boolean_array_integer_like ():
137- # integers of 0's and 1's
138- result = pd .array ([1 , 0 , 1 , 0 ], dtype = "boolean" )
136+ def test_to_boolean_array_from_integer_array ():
137+ result = pd .array (np .array ([1 , 0 , 1 , 0 ]), dtype = "boolean" )
139138 expected = pd .array ([True , False , True , False ], dtype = "boolean" )
140139 tm .assert_extension_array_equal (result , expected )
141140
142- result = pd .array (np .array ([1 , 0 , 1 , 0 ]), dtype = "boolean" )
141+ # with missing values
142+ result = pd .array (np .array ([1 , 0 , 1 , None ]), dtype = "boolean" )
143+ expected = pd .array ([True , False , True , None ], dtype = "boolean" )
143144 tm .assert_extension_array_equal (result , expected )
144145
146+
147+ def test_to_boolean_array_from_float_array ():
145148 result = pd .array (np .array ([1.0 , 0.0 , 1.0 , 0.0 ]), dtype = "boolean" )
149+ expected = pd .array ([True , False , True , False ], dtype = "boolean" )
146150 tm .assert_extension_array_equal (result , expected )
147151
148152 # with missing values
149- result = pd .array ([ 1 , 0 , 1 , None ] , dtype = "boolean" )
153+ result = pd .array (np . array ([ 1.0 , 0.0 , 1.0 , np . nan ]) , dtype = "boolean" )
150154 expected = pd .array ([True , False , True , None ], dtype = "boolean" )
151155 tm .assert_extension_array_equal (result , expected )
152156
153- result = pd .array (np .array ([1.0 , 0.0 , 1.0 , np .nan ]), dtype = "boolean" )
157+
158+ def test_to_boolean_array_integer_like ():
159+ # integers of 0's and 1's
160+ result = pd .array ([1 , 0 , 1 , 0 ], dtype = "boolean" )
161+ expected = pd .array ([True , False , True , False ], dtype = "boolean" )
162+ tm .assert_extension_array_equal (result , expected )
163+
164+ # with missing values
165+ result = pd .array ([1 , 0 , 1 , None ], dtype = "boolean" )
166+ expected = pd .array ([True , False , True , None ], dtype = "boolean" )
154167 tm .assert_extension_array_equal (result , expected )
155168
156169
0 commit comments