On Thu, May 09, 2013 at 12:00:16AM +0200, Jeroen Demeyer wrote:
> I should add that the doctest syntax you are using should work with
> the standard Python doctest module. That is: if whatever syntax
> you're using works with the Python doctesting framework, but not
> with Sage, then that's a bug with Sage's doctesting framework. If
> your syntax doesn't even work with Python's doctesting framework,
> then it's not our fault...

Fair enough: the closer to Python we are, the better.

I just made some tests (see attached file). Clearly Python uses
introspection. Once we know that we can start having fun and play
tricks. The syntax I was looking for works, or something close enough
is doable. I'll adapt our two tickets accordingly!

Thanks,

Cheers,
                                Nicolas
--
Nicolas M. ThiƩry "Isil" <nthi...@users.sf.net>
http://Nicolas.Thiery.name/

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


x = \
"""
    >>> 1+1  # ignored by Python
    4
"""


class A:
    """
        >>> 1+1
        A1
    """
    def f(x):
        pass

    """
       >>> 1+1 # ignored by Python
       A2
    """

# Everything below is tested properly by Python!

class B:
    pass

B.__doc__ = """
    >>> 1 + 1
    B
"""

class C:
    __doc__ = """
        >>> 1 + 1
        C1
    """

    __doc__ += """
        >>> 1 + 1
        C2
    """

class D:
    """
        >>> 1 + 1
        D1
    """

    __doc__ += """
        >>> 1 + 1
        D2
    """

class E1:
    class E2:
        class E3:
            """
               >>> 1 + 1
               E3
            """

if __name__ == "__main__":
    import doctest
    doctest.testmod()

Reply via email to