Cleanup whitespaces and dead code
diff --git a/TestON/core/teston.py b/TestON/core/teston.py
index fc85c55..ba4e74f 100644
--- a/TestON/core/teston.py
+++ b/TestON/core/teston.py
@@ -280,13 +280,11 @@
self.stepCache += "\t"+str(testCaseNumber)+"."+str(step)+" "+self.stepName+" - "
if self.STEPRESULT == self.TRUE:
self.stepCache += "PASS\n"
- #self.stepCache += "PASS <ac:emoticon ac:name=\"tick\" /></li>\n"
elif self.STEPRESULT == self.FALSE:
self.stepCache += "FAIL\n"
- #self.stepCache += "FAIL <ac:emoticon ac:name=\"cross\" /></li>\n"
+ # TODO: Print the on-fail statement here
else:
self.stepCache += "No Result\n"
- #self.stepCache += "No Result <ac:emoticon ac:name=\"warning\" /></li>\n"
self.stepResults.append(self.STEPRESULT)
except StandardError as e:
self.log.exception( "\nException in the following section of" +
diff --git a/TestON/core/utilities.py b/TestON/core/utilities.py
index dda43bf..8cb681d 100644
--- a/TestON/core/utilities.py
+++ b/TestON/core/utilities.py
@@ -84,27 +84,27 @@
return result
return assertHandling
- def _assert (self,**assertParam):
+ def _assert (self,**assertParam):
'''
It will take the arguments :
- expect:'Expected output'
- actual:'Actual output'
+ expect:'Expected output'
+ actual:'Actual output'
onpass:'Action or string to be triggered or displayed respectively when the assert passed'
onfail:'Action or string to be triggered or displayed respectively when the assert failed'
not:'optional argument to specify the negation of the each assertion type'
operator:'assertion type will be defined by using operator. Like equal , greater, lesser, matches.'
-
+
It will return the assertion result.
-
+
'''
-
+
arguments = self.parse_args(["EXPECT","ACTUAL","ONPASS","ONFAIL","NOT","OPERATOR"],**assertParam)
-
+
result = 0
valuetype = ''
operation = "not "+ str(arguments["OPERATOR"]) if arguments['NOT'] and arguments['NOT'] == 1 else arguments["OPERATOR"]
operators = {'equals':{'STR':'==','NUM':'=='}, 'matches' : '=~', 'greater':'>' ,'lesser':'<'}
-
+
expectMatch = re.match('^\s*[+-]?0(e0)?\s*$', str(arguments["EXPECT"]), re.I+re.M)
if not ((not expectMatch) and (arguments["EXPECT"]==0)):
valuetype = 'NUM'
@@ -112,31 +112,30 @@
if arguments["OPERATOR"] == 'greater' or arguments["OPERATOR"] == 'lesser':
main.log.error("Numeric comparison on strings is not possibele")
return main.ERROR
-
+
valuetype = 'STR'
arguments["ACTUAL"] = str(arguments["ACTUAL"])
if arguments["OPERATOR"] != 'matches':
arguments["EXPECT"] = str(arguments["EXPECT"])
-
+
try :
opcode = operators[str(arguments["OPERATOR"])][valuetype] if arguments["OPERATOR"] == 'equals' else operators[str(arguments["OPERATOR"])]
-
+
except KeyError:
print "Key Error in assertion"
return main.FALSE
-
+
if opcode == '=~':
try:
assert re.search(str(arguments["EXPECT"]),str(arguments["ACTUAL"]))
result = main.TRUE
except AssertionError:
try :
- assert re.match(str(arguments["EXPECT"]),str(arguments["ACTUAL"]))
+ assert re.match(str(arguments["EXPECT"]),str(arguments["ACTUAL"]))
result = main.TRUE
except AssertionError:
main.log.error("Assertion Failed")
result = main.FALSE
-
else :
try:
if str(opcode)=="==":
@@ -145,27 +144,21 @@
result = main.TRUE
else :
result = main.FALSE
-
elif str(opcode) == ">":
main.log.info("Verifying the Expected is Greater than the actual or not using assert_greater")
if (ast.literal_eval(arguments["EXPECT"]) > ast.literal_eval(arguments["ACTUAL"])) :
result = main.TRUE
else :
result = main.FALSE
-
elif str(opcode) == "<":
main.log.info("Verifying the Expected is Lesser than the actual or not using assert_lesser")
if (ast.literal_eval(arguments["EXPECT"]) < ast.literal_eval(arguments["ACTUAL"])):
result = main.TRUE
else :
result = main.FALSE
-
-
except AssertionError:
main.log.error("Assertion Failed")
result = main.FALSE
-
-
result = result if result else 0
result = not result if arguments["NOT"] and arguments["NOT"] == 1 else result
resultString = ""
@@ -179,7 +172,7 @@
else :
main.log.error(arguments["ONFAIL"])
main.log.report(arguments["ONFAIL"])
-
+
msg = arguments["ON" + str(resultString)]
if not isinstance(msg,str):
@@ -190,8 +183,7 @@
main.last_result = result
return result
-
-
+
def parse_args(self,args, **kwargs):
'''
It will accept the (key,value) pair and will return the (key,value) pairs with keys in uppercase.