@@ -288,26 +288,33 @@ def test_textarea_emptyfirstline(self):
288288class TestFormLint (unittest .TestCase ):
289289
290290 def test_form_lint (self ):
291- form = webtest .Form (None , '''<form>
291+ def _build_response (html ):
292+ return webtest .TestResponse ('<body>{}</body>' .format (html ))
293+
294+ html = '''<form>
292295 <input type="text" name="field"/>
293- </form>''' )
296+ </form>'''
297+ form = webtest .Form (_build_response (html ), html )
294298 self .assertRaises (AttributeError , form .lint )
295299
296- form = webtest . Form ( None , '''<form>
300+ html = '''<form>
297301 <input type="text" id="myfield" name="field"/>
298- </form>''' )
302+ </form>'''
303+ form = webtest .Form (_build_response (html ), html )
299304 self .assertRaises (AttributeError , form .lint )
300305
301- form = webtest . Form ( None , '''<form>
306+ html = '''<form>
302307 <label for="myfield">my field</label>
303308 <input type="text" id="myfield" name="field"/>
304- </form>''' )
309+ </form>'''
310+ form = webtest .Form (_build_response (html ), html )
305311 form .lint ()
306312
307- form = webtest . Form ( None , '''<form>
313+ html = '''<form>
308314 <label class="field" for="myfield" role="r">my field</label>
309315 <input type="text" id="myfield" name="field"/>
310- </form>''' )
316+ </form>'''
317+ form = webtest .Form (_build_response (html ), html )
311318 form .lint ()
312319
313320
0 commit comments