This commit is contained in:
Mike Bayer
2005-09-17 04:06:19 +00:00
parent 14c7262635
commit fa9a82a86f
2 changed files with 25 additions and 6 deletions
+6 -6
View File
@@ -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(
+19
View File
@@ -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)