On 02/13/12 13:51, Ryan wrote:
> #this test case will pass
> def TestCase1():
>     r'''
>         Examples::
>         
>             sage: ascii()
>             'abcdefghijklmnopqrstuvwxyz'
> 
>     '''
>     pass


Nesting single quotes like this is bound to fail in surprising ways.
This test isn't even run.


> #this test case will fail
> def TestCase2():
>     r"""
>         Examples::
>         
>             sage: ascii()
>             'abcdefghijklmnopqrstuvwxyz'
>         
>     """
>     pass

This one fails because the doctest framework doesn't do imports for you.

Assuming you stick this in devel/sage-main/sage/ascii_test.py *and run
sage -b* you can do,

  def ascii():
      r"""

          Examples::

              sage: from sage.ascii_test import ascii
              sage: ascii()
              'abcdefghijklmnopqrstuvwxyz'

      """
      return string.ascii_lowercase


Note the import within the doctest.

-- 
To post to this group, send an email to [email protected]
To unsubscribe from this group, send an email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to