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

jjlee at codespeak.net jjlee at codespeak.net
Sat Sep 24 22:47:00 CEST 2005


Author: jjlee
Date: Sat Sep 24 22:46:59 2005
New Revision: 17842

Modified:
   wwwsearch/ClientForm/branch/0.1-maint/test.py
Log:
Add another test to check backwards-compat for version 0.2

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	Sat Sep 24 22:46:59 2005
@@ -1539,6 +1539,32 @@
 
 class FormTests(TestCase):
     base_uri = "http://auth.athensams.net/"
+
+    def test_deselect_disabled(self):
+        f = StringIO("""\
+<form>
+    <input type="checkbox" name="p" value="a" disabled checked></input>
+    <input type="checkbox" name="p" value="b"></input>
+    <input type="checkbox" name="p" value="c"></input>
+</form>
+""")
+        def new_form():
+            f.seek(0)
+            form = ClientForm.ParseFile(f, "http://example.com/")[0]
+            ctl = form.find_control("p")
+            return form, ctl
+        form, ctl = new_form()
+        ctl.value = ["b"]
+
+        # rationale: allowed to deselect, but not select, disabled
+        # items
+        form, ctl = new_form()
+        self.assertRaises(AttributeError, ctl.set, True, "a")
+        self.assertRaises(AttributeError, setattr, ctl, "value", ["a"])
+        ctl.set(False, "a")
+        form, ctl = new_form()
+        ctl.value = ["b"]
+
     def test_click(self):
         file = StringIO(
 """<form action="abc" name="myform">


More information about the wwwsearch-commits mailing list