[wwwsearch-commits] r33623 - wwwsearch/mechanize/trunk/test

jjlee at codespeak.net jjlee at codespeak.net
Tue Oct 24 01:37:28 CEST 2006


Author: jjlee
Date: Tue Oct 24 01:37:26 2006
New Revision: 33623

Added:
   wwwsearch/mechanize/trunk/test/test_forms.doctest
Log:
Test for ClientForm bug fixed in r33622 (_rfc3986.urlunparse usage: use None for missing fragment, not empty string)

Added: wwwsearch/mechanize/trunk/test/test_forms.doctest
==============================================================================
--- (empty file)
+++ wwwsearch/mechanize/trunk/test/test_forms.doctest	Tue Oct 24 01:37:26 2006
@@ -0,0 +1,35 @@
+Integration regression test for case where ClientForm handled RFC 3986
+url unparsing incorrectly (it was using "" in place of None for
+fragment, due to continuing to support use of stdlib module urlparse
+as well as mechanize._rfc3986).  Fixed in ClientForm r33622 .
+
+>>> import mechanize
+>>> from mechanize._response import test_response
+
+>>> def forms():
+...     forms = []
+...     for method in ["GET", "POST"]:
+...         data = ('<form action="" method="%s">'
+...         '<input type="submit" name="s"/></form>' % method
+...         )
+...         br = mechanize.Browser()
+...         response = test_response(data, [("content-type", "text/html")])
+...         br.set_response(response)
+...         br.select_form(nr=0)
+...         forms.append(br.form)
+...     return forms
+
+>>> getform, postform = forms()
+>>> getform.click().get_full_url()
+'http://example.com/?s='
+>>> postform.click().get_full_url()
+'http://example.com/'
+
+>>> data = '<form action=""><isindex /></form>'
+>>> br = mechanize.Browser()
+>>> response = test_response(data, [("content-type", "text/html")])
+>>> br.set_response(response)
+>>> br.select_form(nr=0)
+>>> br.find_control(type="isindex").value = "blah"
+>>> br.click(type="isindex").get_full_url()
+'http://example.com/?blah'


More information about the wwwsearch-commits mailing list