@@ -42,15 +42,15 @@ def test_get_bool_data_preserve_dtype(self):
4242 def test_nonzero_single_element (self ):
4343 # allow single item via bool method
4444 msg = (
45- "NDFrame.bool is now deprecated and will be removed in future releases "
46- "and cases that relied on it will raise in a future version "
45+ "NDFrame.bool is now deprecated and will be removed in future version of pandas "
46+ "and cases that relied on it will raise a future warning "
4747 )
48- with tm .assert_produces_warning (FutureWarning , match = msg ):
49- ser = Series ([True ])
48+ ser = Series ([True ])
49+ ser1 = Series ([False ])
50+ while tm .assert_produces_warning (FutureWarning , match = msg ):
5051 assert ser .bool ()
5152
52- ser = Series ([False ])
53- assert not ser .bool ()
53+ assert not ser1 .bool ()
5454
5555 @pytest .mark .parametrize ("data" , [np .nan , pd .NaT , True , False ])
5656 def test_nonzero_single_element_raise_1 (self , data ):
@@ -64,12 +64,11 @@ def test_nonzero_single_element_raise_1(self, data):
6464 @pytest .mark .parametrize ("data" , [np .nan , pd .NaT ])
6565 def test_nonzero_single_element_raise_2 (self , data ):
6666 msg = (
67- "NDFrame.bool is now deprecated and will be removed in future releases "
68- "and cases that relied on it will raise in a future version "
67+ "NDFrame.bool is now deprecated and will be removed in future version of pandas "
68+ "and cases that relied on it will raise a future warning "
6969 )
70- with tm .assert_produces_warning (FutureWarning , match = msg ):
71- series = Series ([data ])
72-
70+ series = Series ([data ])
71+ while tm .assert_produces_warning (FutureWarning , match = msg ):
7372 msg = "bool cannot act on a non-boolean single element Series"
7473 with pytest .raises (ValueError , match = msg ):
7574 series .bool ()
@@ -78,12 +77,11 @@ def test_nonzero_single_element_raise_2(self, data):
7877 def test_nonzero_multiple_element_raise (self , data ):
7978 # multiple bool are still an error
8079 msg = (
81- "NDFrame.bool is now deprecated and will be removed in future releases "
82- "and cases that relied on it will raise in a future version "
80+ "NDFrame.bool is now deprecated and will be removed in future version of pandas "
81+ "and cases that relied on it will raise a future warning "
8382 )
84- with tm .assert_produces_warning (FutureWarning , match = msg ):
85- series = Series ([data ])
86-
83+ series = Series ([data ])
84+ while tm .assert_produces_warning (FutureWarning , match = msg ):
8785 msg = "The truth value of a Series is ambiguous"
8886 with pytest .raises (ValueError , match = msg ):
8987 bool (series )
@@ -94,8 +92,8 @@ def test_nonzero_multiple_element_raise(self, data):
9492 def test_nonbool_single_element_raise (self , data ):
9593 # single non-bool are an error
9694 msg = (
97- "NDFrame.bool is now deprecated and will be removed in future releases "
98- "and cases that relied on it will raise in a future version "
95+ "NDFrame.bool is now deprecated and will be removed in future version of pandas "
96+ "and cases that relied on it will raise a future warning "
9997 )
10098 with tm .assert_produces_warning (FutureWarning , match = msg ):
10199 series = Series ([data ])
0 commit comments