Ejemplo n.º 1
0
    def test_restriction(self):
        """Tests the options.restriction function"""

        con = DbTestCase.connection
        user = con.table("user")

        self.assertEqual(u"a.id is null", options.restriction("a", user.column("id"), "=", None))
        self.assertEqual(u"id is null", options.restriction(None, user.column("id"), "=", None))
        self.assertEqual(u"a.id = 7", options.restriction("a", user.column("id"), "=", 7))
        self.assertEqual(u"a.id = 'a'", options.restriction("a", user.column("id"), "=", "a"))
        self.assertEqual(u"id = 'a'", options.restriction(None, user.column("id"), "=", "a"))
        self.assertRaises(Exception, options.restriction, None, None, None, None)
Ejemplo n.º 2
0
 def restriction(self, *args):
     return restriction(*args)