Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_instance(self):
instance = TestClass()
self.assertEqual(sqlrepr(instance), repr(instance))
def test_op(self):
instance = SQLOp('and', 'this', 'that')
self.assertEqual(sqlrepr(instance), repr(instance))
def test_newstyle(self):
instance = NewTestClass()
self.assertEqual(sqlrepr(instance), repr(instance))
def test_bool(self):
self.assertEqual(sqlrepr(TRUE, 'postgres'), "'t'")
self.assertEqual(sqlrepr(FALSE, 'postgres'), "'f'")
self.assertEqual(sqlrepr(TRUE, 'mysql'), "1")
self.assertEqual(sqlrepr(FALSE, 'mysql'), "0")
def test_string_b(self):
self.assertEqual(sqlrepr('A String\bAnother', 'postgres'), "'A String\\bAnother'")
def test_delete(self):
instance = Delete('test', None)
self.assertEqual(sqlrepr(instance), repr(instance))
def getValsCol(column):
i = sqlbuilder.table.Image
c = sqlbuilder.table.Image.__getattr__(column)
rid = getRID()
where = (i.enzorun_ID == rid)
a = sqlbuilder.Select(c, where=where, distinct=True)
a = model.Image._connection.queryAll(sqlbuilder.sqlrepr(a))
a = map(str, [r[0] for r in a])
a.sort()
return zip(a,a)
def _postgresType(self):
length = max(map(self._getlength, self.enumValues))
enumValues = ', '.join(
[sqlbuilder.sqlrepr(v, 'postgres') for v in self.enumValues])
checkConstraint = "CHECK (%s in (%s))" % (self.dbName, enumValues)
return "VARCHAR(%i) %s" % (length, checkConstraint)