← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #188596]: Unit Testing: Unable to call a function that i define in the same class

 

Question #188596 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/188596

    Status: Open => Answered

RaiMan proposed the following answer:
--1:        run def go_there() 
that is not Python.
if you have a function defined somewhere as:
def go_there():
    ... some code here

then it has to be called as
go_there()

--2: using self defined functions in IDE test view
the test view has many quirks. It is only suitable for basic stuff. and already using functions is no basic stuff :-(
Before investing further: look faq 1804

If you want to stick with IDE test view:
--- put your own def's to the end of the script in reverse order as they are used
--- define them as:
def my_function(self):
--- call them using:
self.my_function()

in the definition you might add additional parameters after the self, that could be give in the call
def my_function(self, parm1):
    print parm1

... calling
self.my_function("this is a test")

would print: this is a test

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.