On 6/10/2013 9:04 PM, brian wrote:
I can't find the doc on findTestScript. Is <c> what I referred to as the sum or is this a built in value? Also how do I pass parameters?

Thanks for the quick response!!!

Brian

You said that your node "sumNode" contained the following code:

----
def sum(a, b):
    return a + b
----

Now, you want to call sum() from another node, say "<project1>":

----
exec(g.findTestScript(c, "sumNode"))
c = sum(1,2)
----

What g.findTestScript(<controller>, <script>) does is return the body of the node with the name <script> in the given <controller>. The controller is your current Leo outline, and that is stored in the global variable 'c', such that g.findTestScript(c, "sumNode") returns the body of the node "sumNode" in the current Leo doc. Wrapping that in exec() simply executes that string as python code.

As for docs, the best places to look at the moment are leoPyRef.leo, the leoeditor.com docs, and the ReadTheDocs page (http://leo-editor.readthedocs.org). Here's a direct link to the findTestScript code: http://leo-editor.readthedocs.org/en/latest/_modules/leo/core/leoGlobals.html#findTestScript (don't feel bad about not finding it - it doesn't have a docstring, and it's only briefly mentioned in passing on the leoeditor site: http://leoeditor.com/unitTesting.html?highlight=findtestscript#using-mark-for-unit-tests).

Hope this helps!
-->Jake


--
You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.



--
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to