assert(function name)
In my function module having a function,
def Enable(obj1,obj2):
m=findBest(
m.getIndex(
print(
if m.getIndex()==0:
else:
In another module where class is defined I am importing this module and asserting the functions
import function module name
class Test(unittest.
def test01():
The assert always resulting as failed eventhough it is supposed to be passed.
Please note that for the functions using if exists(image) , assert is working as expected.
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Sikuli Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Sreelekshmi
- Solved:
- 2020-03-31
- Last query:
- 2020-03-31
- Last reply:
- 2020-03-30
RaiMan (raimund-hocke) said : | #1 |
the function does not return a suitable value for assert:
def Enable(obj1,obj2):
m=findBest(
# m.getIndex(
print(
if m.getIndex()==0:
return True
else:
return false
Manfred Hampl (m-hampl) said : | #2 |
assert() needs a boolean value, but your subroutine Enable(obj1,obj2) does not return anything.
Sreelekshmi (sree2604) said : | #3 |
sorry I missed that, my function returns true or false . Still assert always fails.
Manfred Hampl (m-hampl) said : | #4 |
What's now the relevant snippet of your code?
Sreelekshmi (sree2604) said : | #5 |
def Enable(obj1,obj2):
m=findBest(
m.getIndex(
print(
if m.getIndex()==0:
return True
else:
return False
class Test(unittest.
def test01():
assert always fail
Sreelekshmi (sree2604) said : | #6 |
def Enable(obj1,obj2):
m=findBest(
m.getIndex(
print(
if m.getIndex()==0:
return True
else:
return False
class Test(unittest.
def test01():
assert always fail
Manfred Hampl (m-hampl) said : | #7 |
What do the print statements show when running the program?
What should the statment
m.getIndex(
do (already asked by RaiMan)? It does not make any sense.
Sreelekshmi (sree2604) said : | #8 |
Hi Manfred, Its working , I just had to restart the sikuli. Thanks :-)