[wwwsearch-commits] r17748 - wwwsearch/ClientForm/branch/0.1-maint

jjlee at codespeak.net jjlee at codespeak.net
Wed Sep 21 23:58:30 CEST 2005


Author: jjlee
Date: Wed Sep 21 23:58:29 2005
New Revision: 17748

Modified:
   wwwsearch/ClientForm/branch/0.1-maint/test.py
Log:
Add test about ClientForm 0.1 set_value_by_label behaviour, to get 0.2 backwards-compatible

Modified: wwwsearch/ClientForm/branch/0.1-maint/test.py
==============================================================================
--- wwwsearch/ClientForm/branch/0.1-maint/test.py	(original)
+++ wwwsearch/ClientForm/branch/0.1-maint/test.py	Wed Sep 21 23:58:29 2005
@@ -1631,6 +1631,28 @@
     def testFullSearch(self):
         pass  # XXX
 
+    def testSetValueByLabelIgnoringAmbiguity(self):
+        # Regression test introduced to check that ClientForm 0.2 follows
+        # ClientForm 0.1 behaviour.
+        f = StringIO("""\
+<form>
+    <select multiple name="form.grocery">
+        <option value="bread" id="1">Loaf of Bread</option>
+        <option value="bread" id="2">Loaf of Bread</option>
+        <option value="challah">Loaf of Challah</option>
+    </select>
+    <input type="submit" value="Submit" />
+</form>
+""")
+        form = ClientForm.ParseFile(f, "http://localhost/")[0]
+        f.seek(0)
+        c = form.find_control("form.grocery")
+        c.set_value_by_label(
+            ["Loaf of Bread", "Loaf of Bread", "Loaf of Challah"])
+        # select first item of ambiguous set every time
+        self.assertEqual(
+            c.get_value_by_label(), ["Loaf of Bread", "Loaf of Challah"])
+
     def testGeneralSearch(self):
         file = open("./testdata/GeneralSearch.html", "r")
         forms = ClientForm.ParseFile(file, self.base_uri)


More information about the wwwsearch-commits mailing list