Ejemplo n.º 1
0
    def testBoolean(self):
        b = formless.Boolean(required=True)
        self.assertRaises(formless.InputError, process, b, "zoom")
        self.assertRaises(formless.InputError, process, b, True)
        self.assertRaises(formless.InputError, process, b, 54)
        self.assertRaises(formless.InputError, process, b, "")
        self.assertEqual(process(b, "True"), True)
        self.assertEqual(process(b, "False"), False)

        b = formless.Boolean(required=False)
        self.assertRaises(formless.InputError, process, b, "zoom")
        self.assertEqual(process(b, ""), None)
        self.assertEqual(process(b, "True"), True)
        self.assertEqual(process(b, "False"), False)
Ejemplo n.º 2
0
            def baz(bazfoo=formless.Boolean(label="The Foo", description="The foo to baz.")):
                """The Label

                The description"""
                IFoo = _indirectIFoo()
                return IFoo