PyBaMM
PyBaMM copied to clipboard
Add more doctests to PyBaMM
Description
It would be nice to have examples in docstrings that are tested periodically. For example, the Simulation
class could have something like this -
>>> spm = pybamm.lithium_ion.SPM()
<some output>
>>> sim = pybamm.Simulation(spm)
<some output>
>>> sim.solve([0, 10, 2])
<some output>
Motivation
Would make minor examples available in the documentation itself and would make sure that the docs are not outdated.
Possible Implementation
No response
Additional context
No response
Hey @Saransh-cpp , Can i work on this issue?
Yes! Go ahead! (Multiple people can work on this)
Close or keep open @Saransh-cpp ?
With time I have realized that maybe doctests are not that feasible for PyBaMM. Most of PyBaMM's functionality is designed to integrate together (if I am not wrong), which makes it a bit tough to write standalone (and short) doctests. For instance, writing doctests for solve
would require building a simple model first. Also, the doctests added after the creation of this issue do not test anything substantial, so I think it should be okay to close this issue (?)
Yeah, I agree