#8708: allow doctest script to handle docstrings with triple single quotes
---------------------------------------------------------+------------------
   Reporter:  mvngu                                      |          Owner:  tbd 
         
       Type:  enhancement                                |         Status:  
needs_info   
   Priority:  minor                                      |      Milestone:  
sage-4.7.2   
  Component:  doctest                                    |       Keywords:      
         
Work_issues:  Rebase on #9739 (and perhaps also 10952).  |       Upstream:  N/A 
         
   Reviewer:  Burcin Erocal                              |         Author:  
John Palmieri
     Merged:                                             |   Dependencies:  
#9739        
---------------------------------------------------------+------------------

Comment(by jhpalmieri):

 For the sagenb problem, this patch seems to fix things:
 {{{
 #!diff

 diff --git a/sagenb/notebook/worksheet.py b/sagenb/notebook/worksheet.py
 --- a/sagenb/notebook/worksheet.py
 +++ b/sagenb/notebook/worksheet.py
 @@ -3881,15 +3881,7 @@ except (KeyError, IOError):
              C.delete_output()


 -__internal_test1 = '''
 -def foo(x):
 -    "
 -    EXAMPLES:
 -        sage: 2+2
 -        4
 -    "
 -    return x
 -'''.lstrip()
 +__internal_test1 = '\ndef foo(x):\n    "\n    EXAMPLES:\n        sage:
 2+2\n        4\n    "\n    return x'.lstrip()

  __internal_test2 = '''
  sage: 2 + 2
 }}}
 I don't know if it's the best approach.  Why does this use single double
 quotes, anyway?  Shouldn't the EXAMPLES block be surrounded by `"""`?
 Modifying the patch here to use `"""` still passes doctests.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/8708#comment:19>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to