From 36d52b144a0ed4303c22594f9507b02051c0649d Mon Sep 17 00:00:00 2001 From: LtWorf Date: Mon, 2 May 2011 10:02:06 +0000 Subject: [PATCH] - Using more the colored class - Todo git-svn-id: http://galileo.dmi.unict.it/svn/relational/trunk@298 014f5005-505e-4b48-8d0a-63407b615a7c --- TODO | 1 - test/driver.py | 27 ++++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/TODO b/TODO index 1b926f8..e69de29 100644 --- a/TODO +++ b/TODO @@ -1 +0,0 @@ -- Convert the relation module to use python's sets diff --git a/test/driver.py b/test/driver.py index 461bc29..ba8f14d 100644 --- a/test/driver.py +++ b/test/driver.py @@ -143,16 +143,16 @@ def run_exec_test(testname): return True except: pass - print "\033[31;1mERROR\033[0m" - print "\033[31;1m=====================================\033[0m" + print colored('ERROR','red') + print colored('=====================================','red') print "Expected %s" % exp_result #print "Got %s" % result - print "\033[31;1m=====================================\033[0m" + print colored('=====================================','red') return False def run_py_test(testname): '''Runs a python test, which evaluates expressions directly rather than queries''' - print "Running expression python test: \033[35;1m%s\033[0m" % testname + print "Running expression python test: " + colored (testname,'magenta') try: @@ -163,15 +163,16 @@ def run_py_test(testname): exp_result=eval(expr,rels) #Evaluating the expression if result==exp_result: - print "\033[32;1mTest passed\033[0m" + print colored('Test passed','green') return True except: pass - print "\033[31;1mERROR\033[0m" - print "\033[31;1m=====================================\033[0m" + + print colored('ERROR','red') + print colored('=====================================','red') print "Expected %s" % exp_result print "Got %s" % result - print "\033[31;1m=====================================\033[0m" + print colored('=====================================','red') return False def run_test(testname): @@ -181,7 +182,7 @@ def run_test(testname): testname.result The query will be executed both unoptimized and optimized''' - print "Running test: \033[35;1m%s\033[0m" % testname + print "Running test: "+ colored(testname,'magenta') query=None;expr=None;o_query=None;o_expr=None result_rel=None @@ -203,15 +204,15 @@ def run_test(testname): if (o_result==result_rel) and (result==result_rel): - print "\033[32;1mTest passed\033[0m" + print colored('Test passed','green') return True except Exception as inst: print inst pass - print "\033[31;1mERROR\033[0m" + print colored('ERROR','red') print "Query: %s -> %s" % (query,expr) print "Optimized query: %s -> %s" % (o_query,o_expr) - print "\033[31;1m=====================================\033[0m" + print colored('=====================================','red') print "\033[33;1mExpected result\033[0m" print result_rel print "\033[33;1mResult\033[0m" @@ -220,7 +221,7 @@ def run_test(testname): print o_result print "\033[33;1moptimized result match\033[0m", result_rel==o_result print "\033[33;1mresult match \033[0m", result==result_rel - print "\033[31;1m=====================================\033[0m" + print colored('=====================================','red') return False