4 ms·
Really loving those markdown style tests. I think it's a really fantastic idea that allows the tests to easily act as documentation too. Can you explain how yo
by flakes 1y ago
Really loving those markdown style tests. I think it's a really fantastic idea that allows the tests to easily act as documentation too.
Can you explain how you came up with this solution? Rust docs code-examples inspired?
- indiosmo 1y agoElixir has this. https://hexdocs.pm/elixir/main/docs-tests-and-with.html https://hexdocs.pm/elixir/main/docs-tests-and-with.html
- hathawsh 1y agoThat concept has been formalized as part of the Python standard library. https://docs.python.org/3/library/doctest.html https://docs.python.org/3/library/doctest.html
- flakes 1y agoAh very nice! Did not realize this was a part of the standard library!
- lmz 1y agoIt's been there since Python v2.1 https://docs.python.org/release/2.1/lib/module-doctest.html https://docs.python.org/release/2.1/lib/module-doctest.html
- sakesun 1y agoHere is the first announce of doctest I can find (1999) I think it's Python 1.5 time. https://groups.google.com/g/comp.lang.python/c/DfzH5Nrt05E/m/Yyd3s7fPVxwJ?pli=1 https://groups.google.com/g/comp.lang.python/c/DfzH5Nrt05E/m...
- deleted 1y ago[deleted]
- deleted 1y ago[deleted]
- __mharrison__ 1y agoI use this in my books to show the output but also to "test" that the code found in my books actually works.
- _whiteCaps_ 1y agoI love doctest as it works so well with a REPL but unfortunately it hasn't really gained traction anywhere I've seen.