On Friday, October 12, 2018 at 4:33:18 AM UTC-5, Edward K. Ream wrote:
*> Leo outlines could benefit from a third dimension.*
One way to "fake" a third dimension in an external .py file is with a
"compile-time" test:
<< define factorial >>
if g.unitTesting:
- << define @test nodes >>
@others
- @test factorial
assert factorial(5) == 120
Alas, this does not work either. The "inner" @test nodes do not have
automatic access to the factorial function defined in the same file!
Gaining access to factorial is certainly possible within the @test node,
but doing so negates the advantage of using an @test node.
Furthermore, the test on g.unitTesting seems fraught with danger. It's
*always* a dubious idea to make exceptions for unit tests. What happens,
for example, if a unit test does imp.reload on the file containing
factorial? Maybe everything will work as expected, but this is definitely
pressing our luck.
Edward
--
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 https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.