My intuitive thought is that there are two types of tests in Leo,
1. Testing of common Python function script nodes,
2. Tests that require a Leo context, such as g, c, p, etc.
2.1 Test with Leo already open, because there are already g, c, p
2.2 Testing without Leo open. It is no different from a normal python program. e.g. 'python -m unittest'
For 1, if I have such a Leo script node, can I test it?
```
def add(a, b):
return a + b
import unittest
class TestAddFunction(unittest.TestCase):
def test_add(self):
self.assertEqual(add(1, 2), 3)
self.assertEqual(add(-1, 1), 0)
self.assertEqual(add(-1, -1), -2)
```
For 2, Is this possible for the case in 2.1?
I flipped through the posts in the forums and it looked like there should be a 'test-' command, but I only had 'test-one' in my environment, nothing else. `execute-pytest` command also not works(maybe I am doing something wrong)
I failed to find anything in the documentation that made me start. Am I doing something wrong?
Thanks!
Take a look in the leo-editor\leo\unittests directory. For example, test_gui.py imports g. etc. Maybe that will be enough to get started.
My intuitive thought is that there are two types of tests in Leo,
1. Testing of common Python function script nodes,
2. Tests that require a Leo context, such as g, c, p, etc.
2.1 Test with Leo already open, because there are already g, c, p
2.2 Testing without Leo open. It is no different from a normal python program. e.g. 'python -m unittest'
My intuitive thought is that there are two types of tests in Leo,
1. Testing of common Python function script nodes,
2. Tests that require a Leo context, such as g, c, p, etc.
I understand what you're saying, but I still can't seem to explain my problem well.
But for now, that's it. I'll wait until I read more LeoPyRef.
Thank you so much
I understand what you're saying, but I still can't seem to explain my problem well.
But for now, that's it. I'll wait until I read more LeoPyRef.
Thank you so much