mirror of
https://github.com/sqlalchemy/sqlalchemy.git
synced 2026-06-01 21:38:55 -04:00
This commit is contained in:
+6
-6
@@ -268,12 +268,12 @@ EXISTS (select yay from foo where boo = lar)",
|
||||
engine = postgres.engine())
|
||||
|
||||
|
||||
# self.runtest(query,
|
||||
# "SELECT mytable.myid, mytable.name, mytable.description, myothertable.otherid, myothertable.othername \
|
||||
#FROM mytable, myothertable WHERE mytable.myid = myothertable.otherid(+) AND \
|
||||
#mytable.name = :mytable_name AND mytable.myid = :mytable_myid AND \
|
||||
#myothertable.othername != :myothertable_othername AND EXISTS (select yay from foo where boo = lar)",
|
||||
# engine = oracle.engine(use_ansi = False))
|
||||
self.runtest(query,
|
||||
"SELECT mytable.myid, mytable.name, mytable.description, myothertable.otherid, myothertable.othername \
|
||||
FROM mytable, myothertable WHERE mytable.myid = myothertable.otherid(+) AND \
|
||||
mytable.name = :mytable_name AND mytable.myid = :mytable_myid AND \
|
||||
myothertable.othername != :myothertable_othername AND EXISTS (select yay from foo where boo = lar)",
|
||||
engine = oracle.engine(use_ansi = False))
|
||||
|
||||
def testbindparam(self):
|
||||
self.runtest(select(
|
||||
|
||||
@@ -6,6 +6,25 @@ class PersistTest(unittest.TestCase):
|
||||
unittest.TestCase.__init__(self, *args, **params)
|
||||
|
||||
|
||||
class AssertMixin(PersistTest):
|
||||
def assert_result(self, result, class_, *objects):
|
||||
print repr(result)
|
||||
self.assert_list(result, class_, objects)
|
||||
def assert_list(self, result, class_, list):
|
||||
self.assert_(len(result) == len(list), "result list is not the same size as test list")
|
||||
for i in range(0, len(list)):
|
||||
self.assert_row(class_, result[i], list[i])
|
||||
def assert_row(self, class_, rowobj, desc):
|
||||
self.assert_(rowobj.__class__ is class_, "item class is not " + repr(class_))
|
||||
for key, value in desc.iteritems():
|
||||
if isinstance(value, tuple):
|
||||
if isinstance(value[1], list):
|
||||
self.assert_list(getattr(rowobj, key), value[0], value[1])
|
||||
else:
|
||||
self.assert_row(value[0], getattr(rowobj, key), value[1])
|
||||
else:
|
||||
self.assert_(getattr(rowobj, key) == value, "attribute %s value %s does not match %s" % (key, getattr(rowobj, key), value))
|
||||
|
||||
def runTests(suite):
|
||||
runner = unittest.TextTestRunner(verbosity = 2, descriptions =1)
|
||||
runner.run(suite)
|
||||
|
||||
Reference in New Issue
Block a user