Description
Please add a tab to each cell so that they can contain the unit tests code for the functions in the cell.
One of the big deterrents in switching to PretzelAI is the difficulty of handling unit tests.
A way to make tests an integral part of the notebooks would be to add to each cell a tab to switch to the unit tests for the cell code.
The user should be able to write the tests with the pytest library, in three ways:
- Test-Driven Development: Write the code in the tests tab before writing the code in the cell. Then ask the AI to generate the cell code according to the cell test code. Just add a button in the AI toolbar= "generate code from tests".
- Generate Tests from Existing Cell: the AI will examine the code in the cell and generate all the tests for it using pytest in parameter mode. An option "Lint Tests" to ask the AI to check the test code for errors should be added to the toolbar along with the button "Generate Tests".
- Hand-coded tests: tests are written the the user. It can still ask the AI to lint or improve them with the option "Lint Tests".
NOTE: Each cell should have a counter with the number of tests passed and failed. The color of the cell should change to red if all tests are not passed. Also, a global summary of all tests passed in the entire notebook should be displayed in the sidebar, along with a button "Run All Tests". A button "Save Tests Output To File" would be also useful for collaboration.