Go goes the opposite direction with “testable examples” that are written alongside test code and added to generated documentation.
https://docs.python.org/2/library/doctest.html
https://doc.rust-lang.org/rustdoc/documentation-tests.html
https://golang.org/pkg/testing/#hdr-Examples