You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It should be pretty easy to automatically include test example code in our docs via doctest using doctest.testfile on core ReStructuredText files in our docs.
We can also test our demo scripts wherever we end up adding them to the source per #323.
To see how easy it is to us doctest, try out:
# from inside an agentos dev virtualenv
cd agentos
python
>>> import doctest
>>> doctest.testfile("documentation/overview.rst")
**********************************************************************
File "./documentation/repl_quickstart.rst", line 31, in repl_quickstart.rst
Failed example:
from agentos import Component
Exception raised:
Traceback (most recent call last):
File "/opt/homebrew/Caskroom/miniforge/base/envs/tmp_agentos/lib/python3.8/doctest.py", line 1336, in __run
exec(compile(example.source, filename, "single",
File "<doctest repl_quickstart.rst[1]>", line 1, in <module>
from agentos import Component
ImportError: cannot import name 'Component' from 'agentos' (/Users/andyk/Development/agentos/agentos/__init__.py)
**********************************************************************
File "./documentation/repl_quickstart.rst", line 32, in repl_quickstart.rst
Failed example:
adder_component = Component.from_class(Adder)
Exception raised:
Traceback (most recent call last):
File "/opt/homebrew/Caskroom/miniforge/base/envs/tmp_agentos/lib/python3.8/doctest.py", line 1336, in __run
exec(compile(example.source, filename, "single",
File "<doctest repl_quickstart.rst[2]>", line 1, in <module>
adder_component = Component.from_class(Adder)
NameError: name 'Component' is not defined
**********************************************************************
File "./documentation/repl_quickstart.rst", line 38, in repl_quickstart.rst
Failed example:
adder_component.run('add_one', {'Adder':{'add_one':{'x':1}}})
Exception raised:
Traceback (most recent call last):
File "/opt/homebrew/Caskroom/miniforge/base/envs/tmp_agentos/lib/python3.8/doctest.py", line 1336, in __run
exec(compile(example.source, filename, "single",
File "<doctest repl_quickstart.rst[3]>", line 1, in <module>
adder_component.run('add_one', {'Adder':{'add_one':{'x':1}}})
NameError: name 'adder_component' is not defined
**********************************************************************
1 items had failures:
3 of 4 in repl_quickstart.rst
***Test Failed*** 3 failures.
TestResults(failed=3, attempted=4)
The text was updated successfully, but these errors were encountered:
It should be pretty easy to automatically include test example code in our docs via doctest using
doctest.testfile
on core ReStructuredText files in our docs.We can also test our demo scripts wherever we end up adding them to the source per #323.
To see how easy it is to us doctest, try out:
The text was updated successfully, but these errors were encountered: