Hi,

    A little while back somebody suggested doctesting, I think it was. Well,
anyway, it was the testing that took testing material from the doc strings
of functions in the format of an interpreter and the desired result (example
below). Could anyone help by pointing me to structured documentation on how
to use this, or even the name of the testing module(s)?
Even nicer, a way to put the testing code in a seperate module so all I have
to do is something like...

pseudocode

def test(obj):
    ## Testing particulars -- parameter is a module.function that has a
docstring with testing material

m = raw_input('What is the module? ')
n = raw_input('What is the function? ')
obj = eval(m+'.'+n)  ## Given that I'm the only one who will be using it and
I will not try to crack my computer...
test(obj)

Ohhhhh..
and the doc string example...


def function(a,b):
    """A function to do what you want it to.

    >>> function('3','a')
    '3a'
    >>> function('ask','too')
    'asktoo'
    """
    return a+b




_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to