Return to Snippet

Revision: 19318
at October 21, 2009 10:34 by manatlan


Initial Code
def methodToTest(x):
    """
    >>> methodToTest(2)
    1
    >>> methodToTest(0)
    Traceback (most recent call last):
        ...
    ZeroDivisionError: ...

    >>> range(10)
    [0, 1,  2, ..., 9]
    """
    return 2/x


if __name__ == "__main__":
    import doctest
    doctest.testmod(optionflags=doctest.ELLIPSIS+doctest.NORMALIZE_WHITESPACE)
    #doctest.testfile("example.txt")

Initial URL

                                

Initial Description

                                

Initial Title
python doctests

Initial Tags
python

Initial Language
Python