The doctest module searches for pieces of text that look like interactive
Python sessions, and then executes those sessions to verify that they work
exactly as shown.
Here ur a_list[3] in docstring is 42 then doctest expects it to be 42 for
success. Since u changed 42 to 16 then it is not = 42 as per the
a_list[3]=42 in docstring hence it raises error.

--nitin

On Thu, Aug 26, 2010 at 9:11 PM, Roelof Wobben <rwob...@hotmail.com> wrote:

>  hello,
>
> I have this programm
>
> #  Add your doctests here:
> """
>   >>> a_list[3]
>   42
>   >>> a_list[6]
>   'Ni!'
>   >>> len(a_list)
>   8
> """
> a_list = ['test', 'test','test',42,'test','test','Ni!','test']
> print a_list[3]
> print a_list[6]
> print len(a_list)
> if __name__ == '__main__':
>     import doctest
>     doctest.testmod()
>
> If I change lets say 42 to 16 then the doctest fails with
>
> Expecting
>
> 42
>
> Got
>
> 16.
>
>
> How does doctest now which values are right or not ?
>
> Roelof
>
>
>
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to