@@ -137,21 +137,65 @@ def test_spam_url(self):
137137 "http://ndb.nal.usda.gov/ndb/foods/show/300772?fg=&man=&"
138138 "lfacet=&format=&count=&max=25&offset=&sort=&qlookup=spam"
139139 )
140- df1 = self .read_html (url , ".*Water.*" )
141- df2 = self .read_html (url , "Unit" )
140+ # This test gives match to read_html as a positional
141+ # argument that is now deprecated, so expect FutureWarning
142+ with tm .assert_produces_warning (FutureWarning ):
143+ df1 = self .read_html (url , ".*Water.*" )
144+ with tm .assert_produces_warning (FutureWarning ):
145+ df2 = self .read_html (url , "Unit" )
146+
147+ assert_framelist_equal (df1 , df2 )
148+
149+ @network
150+ def test_spam_url_match_kwarg (self ):
151+ url = (
152+ "http://ndb.nal.usda.gov/ndb/foods/show/300772?fg=&man=&"
153+ "lfacet=&format=&count=&max=25&offset=&sort=&qlookup=spam"
154+ )
155+ # Just like test_spam_url, but passes match as a keyword argument,
156+ # so expect no FutureWarning.
157+ df1 = self .read_html (url , match = ".*Water.*" )
158+ df2 = self .read_html (url , match = "Unit" )
142159
143160 assert_framelist_equal (df1 , df2 )
144161
145162 @pytest .mark .slow
146163 def test_banklist (self ):
147- df1 = self .read_html (self .banklist_data , ".*Florida.*" , attrs = {"id" : "table" })
148- df2 = self .read_html (self .banklist_data , "Metcalf Bank" , attrs = {"id" : "table" })
164+ # This test gives match to read_html as a positional
165+ # argument that is now deprecated, so expect FutureWarning
166+ with tm .assert_produces_warning (FutureWarning ):
167+ df1 = self .read_html (self .banklist_data , ".*Florida.*" , attrs = {"id" : "table" })
168+ with tm .assert_produces_warning (FutureWarning ):
169+ df2 = self .read_html (self .banklist_data , "Metcalf Bank" , attrs = {"id" : "table" })
170+
171+ assert_framelist_equal (df1 , df2 )
172+
173+ @pytest .mark .slow
174+ def test_banklist_match_kwarg (self ):
175+ # Just like test_banklist, but passes match as a keyword argument,
176+ # so expect no FutureWarning.
177+ df1 = self .read_html (self .banklist_data , match = ".*Florida.*" , attrs = {"id" : "table" })
178+ df2 = self .read_html (self .banklist_data , match = "Metcalf Bank" , attrs = {"id" : "table" })
149179
150180 assert_framelist_equal (df1 , df2 )
151181
152182 def test_spam (self ):
153- df1 = self .read_html (self .spam_data , ".*Water.*" )
154- df2 = self .read_html (self .spam_data , "Unit" )
183+ # This test gives match to read_html as a positional
184+ # argument that is now deprecated, so expect FutureWarning
185+ with tm .assert_produces_warning (FutureWarning ):
186+ df1 = self .read_html (self .spam_data , ".*Water.*" )
187+ with tm .assert_produces_warning (FutureWarning ):
188+ df2 = self .read_html (self .spam_data , "Unit" )
189+ assert_framelist_equal (df1 , df2 )
190+
191+ assert df1 [0 ].iloc [0 , 0 ] == "Proximates"
192+ assert df1 [0 ].columns [0 ] == "Nutrient"
193+
194+ def test_spam_match_kwarg (self ):
195+ # Just like test_spam, but passes match as a keyword argument,
196+ # so expect no FutureWarning.
197+ df1 = self .read_html (self .spam_data , match = ".*Water.*" )
198+ df2 = self .read_html (self .spam_data , match = "Unit" )
155199 assert_framelist_equal (df1 , df2 )
156200
157201 assert df1 [0 ].iloc [0 , 0 ] == "Proximates"
0 commit comments