On Mon, Feb 13, 2012 at 11:10 AM, Michael Orlitzky <[email protected]> wrote:
> 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.

I think the problem isn't the nesting of single quote, but just using
singleq quotes ''' at all in a doctest.  I think the doctest script
only extracts tests with double quotes: """.

>
>
>> #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



-- 
William Stein
Professor of Mathematics
University of Washington
http://wstein.org

-- 
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