How to use 'correct way to write doctest in python' in Python

Every line of 'correct way to write doctest in python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
1550def test_doctestmodule_three_tests(self, testdir):
1551 p = testdir.makepyfile("""
1552 '''
1553 >>> dir = getfixture('tmpdir')
1554 >>> type(dir).__name__
1555 'LocalPath'
1556 '''
1557 def my_func():
1558 '''
1559 >>> magic = 42
1560 >>> magic - 42
1561 0
1562 '''
1563 def unuseful():
1564 pass
1565 def another():
1566 '''
1567 >>> import os
1568 >>> os is os
1569 True
1570 '''
1571 """)
1572 reprec = testdir.inline_run(p, "--xdoctest-modules")
1573 reprec.assertoutcome(passed=3)

Related snippets