On Monday, September 7, 2020 at 7:13:28 AM UTC-7, tobia...@gmx.de wrote: > > As for the advantages of unittests over doctests (given my limited > experience with the latter): > - Can easily run and debug single tests >
For the most part, cut/paste realizes that for doctests too > - Get full intellisense and linting support for writing tests > I don't know what intellisense is, but I guess you're worried about code in strings not being recognized by your development environment as code. Usually doctests start out life in an interactive session, and then are copied over. > - Easily share common initialization / teardown code between tests > - Stronger assertions not only relying on string-comparisons > That's not really an issue, since you can always just test: sage: print(assertion) True > - Supports generation of tests based on (external) data, e.g. if you want > to test a method against a range of input -> output pairs > I think you could do that in a doctest; it wouldn't really fit the general setting, though - Ability to mock external objects and services (web resources, libraries > etc) and use dependency injection > ??? > - Test code can rely on additional libraries and other code, that doesn't > need to be shipped > That just makes the tests less reproducible and more fragile. I think it's possible to write unit tests already, so if you prefer you should be able to do that. I know the category framework has some standardized testing. It may be able to be triggered from doctests, even! I don't think it would be wise to allow unit tests *instead of* unit tests, though. There's real value in having almost complete (if flimsy) coverage through one platform. I also don't think it's wise to require *both*. I already find it cumbersome to provide doctests when I contribute something. Having to learn yet another platform and fill in more boiler plate would reduce the attractiveness of contributing considerably. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/120f0571-83bb-4b97-a87d-7ecfac37ce40o%40googlegroups.com.