Unable to add a assertion by custom scripting
Options
LegacyForum
Posts: 1,664 ✭✭
I am trying to check if a number if positive or not by using XML asserter.
After I have written the code I should get the function name in the Method drop down. But I am not able to see that. The drop down is empty. I have attached a screen shot for the same.
Can someone please help me in resolving this?
Regards
Archana
After I have written the code I should get the function name in the Method drop down. But I am not able to see that. The drop down is empty. I have attached a screen shot for the same.
Can someone please help me in resolving this?
Regards
Archana
0
Comments
-
Hi Archana,
I notice two things about the script:
1) The indents are inconsistent, which is actually invalid syntax in Python. In particular, the if-else statement should be indented consistently. Python uses indentation to determine program structure.
2) The else statement should have a colon ( : ) after it.
Note that an easier implementation would be something like this:CODEdef checkid(input, context):
id = float(input)
return id > 00 -
Thanks a lot. I am new to Pyhton so did not know that there would be errors due to indntations.The code is working fien now.
Thanks0 -
You don't need to use scripting. You can create a Numeric Assertion with:
Element must be: >
Expected value (Fixed): 00