Python doctest

def foo():
    """
    >>> foo()
    1
    """
    return 1


if __name__ == "__main__":
    import doctest
    print(doctest.testmod(
        optionflags=doctest.REPORT_ONLY_FIRST_FAILURE
    ))