Ticket #13062: 13062_nodoctest_review.patch

File 13062_nodoctest_review.patch, 10.8 KB (added by jdemeyer, 9 years ago)
  • doc/en/developer/conventions.rst

    # HG changeset patch
    # User Jeroen Demeyer <jdemeyer@cage.ugent.be>
    # Date 1364414417 25200
    # Node ID 3839d3478432627117955b74230efb7cb057e1d8
    # Parent  7667d2d4c6348ca6ac011d35c4c488d56883cabe
    Fix nodoctest parsing
    
    diff --git a/doc/en/developer/conventions.rst b/doc/en/developer/conventions.rst
    a b  
    856856   It is also immediately clear to the user that the indicated example
    857857   does not currently work.
    858858
     859- If one of the first 10 lines of a file starts with ``r""" nodoctest``
     860  (or ``""" nodoctest`` or ``# nodoctest`` or ``% nodoctest`` or
     861  ``.. nodoctest``, or any of these with different spacing), then
     862  that file will be skipped.
     863  If a directory contains a file ``nodoctest.py``, then that whole
     864  directory will be skipped. Neither of this applies to files or
     865  directories which are explicitly given as command line arguments:
     866  those are always tested.
     867
    859868- If a line contains ``# optional - PKGNAME`` (where the ``#`` may be any
    860869  non-letter non-space character), it is not tested unless
    861870  the ``--optional=PKGNAME`` flag is passed to ``sage -t``.
  • sage/all_cmdline.py

    diff --git a/sage/all_cmdline.py b/sage/all_cmdline.py
    a b  
    1111#                  http://www.gnu.org/licenses/
    1212#############################################################################
    1313
    14 """nodoctest"""
    15 
    1614sage_mode = 'cmdline'
    1715
    1816try:
  • sage/all_notebook.py

    diff --git a/sage/all_notebook.py b/sage/all_notebook.py
    a b  
    1 """nodoctest"""
    2 
    31from sage.all import *
    42preparser(on=True)
    53
  • sage/databases/all.py

    diff --git a/sage/databases/all.py b/sage/databases/all.py
    a b  
    1 """nodoctest
     1"""
    22This file gathers together all the tables in Sage.
    33
    4     * ConwayPolynomials -- database of selected Conway polynomials.
     4    * ConwayPolynomials() -- database of selected Conway polynomials.
    55
    66    * CremonaDatabase() - Cremona's tables of elliptic curves and related data.
    77
    8     * Gamma0Wt2Database() -- table of arithmetic information about
    9                     newforms of weight 2 on Gamma_0(N).
     8    * JonesDatabase() -- returns the John Jones table of number fields
     9      with bounded ramification and degree <= 6.
    1010
    11     * JonesDatabase() -- returns the John Jones table of number fields
    12                 with bounded ramification and degree <= 6.
    13 
    14     * SteinWatkinsDatabase() - The Stein-Watkins tables of elliptic curves
    15                 and related data.
     11    * SteinWatkinsAllData() and SteinWatkinsPrimeData() - The
     12      Stein-Watkins tables of elliptic curves and related data.
    1613
    1714    * Sloane's tables -- sloane_sequence, sloane_find
    1815
    1916    * SymbolicData() -- many benchmark and testing ideals
    2017
    21     * Symbolic Data -- benchmark and test ideals
     18EXAMPLES::
    2219
    23 EXAMPLES:
    2420    sage: ConwayPolynomials()
    2521    Frank Luebeck's database of Conway polynomials
    2622
    2723    sage: CremonaDatabase()
    28     Cremona's database of elliptic curves
    29 
    30     sage: Gamma0Wt2Database()
    31     Table of arithmetic information about newforms of weight 2 on Gamma_0(N)
     24    Cremona's database of elliptic curves with conductor...
    3225
    3326    sage: JonesDatabase()
    3427    John Jones's table of number fields with bounded ramification and degree <= 6
    3528
    36     sage: SteinWatkinsDatabase()
    37     The Stein-Watkins database of elliptic curves
    38 
    3929    sage: SymbolicData()
    40     SymbolicData with 372 ideals
    41 
     30    SymbolicData with ... ideals
    4231"""
    4332
    4433#*****************************************************************************
    45 #       Sage: System for Algebra and Geometry Experimentation
    46 #
    4734#       Copyright (C) 2005 William Stein <wstein@gmail.com>
    4835#
    4936#  Distributed under the terms of the GNU General Public License (GPL)
    50 #
    51 #    This code is distributed in the hope that it will be useful,
    52 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
    53 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    54 #    General Public License for more details.
    55 #
    56 #  The full text of the GPL is available at:
    57 #
     37#  as published by the Free Software Foundation; either version 2 of
     38#  the License, or (at your option) any later version.
    5839#                  http://www.gnu.org/licenses/
    5940#*****************************************************************************
    6041
     42
    6143from sql_db import SQLQuery, SQLDatabase
    6244
    6345from conway import ConwayPolynomials
  • sage/databases/lincodes.py

    diff --git a/sage/databases/lincodes.py b/sage/databases/lincodes.py
    a b  
    1 """nodoctest
     1"""
    22Linear codes
    33"""
    44
  • sage/doctest/control.py

    diff --git a/sage/doctest/control.py b/sage/doctest/control.py
    a b  
    2727from reporting import DocTestReporter
    2828from util import NestedName, Timer, count_noun, dict_difference
    2929
    30 nodoctest_regex = re.compile(r'\s*(#+|%+|\.\.)\s*nodoctest')
     30nodoctest_regex = re.compile(r'\s*(#+|%+|r"+|"+|\.\.)\s*nodoctest')
    3131
    3232class DocTestDefaults(SageObject):
    3333    """
     
    430430            sage: DC.expand_files_into_sources()
    431431            sage: DC.sources
    432432            []
     433
     434        The directory ``sage/doctest/tests`` contains ``nodoctest.py``
     435        but the files should still be tested when that directory is
     436        explicitly given (as opposed to being recursed into)::
     437
     438            sage: DC = DocTestController(DD, [os.path.join(SAGE_SRC, 'sage', 'doctest', 'tests')])
     439            sage: DC.expand_files_into_sources()
     440            sage: len(DC.sources) >= 10
     441            True
    433442        """
    434443        def skipdir(dirname):
    435444            if os.path.exists(os.path.join(dirname, "nodoctest.py")):
  • sage/schemes/all.py

    diff --git a/sage/schemes/all.py b/sage/schemes/all.py
    a b  
    1 """nodoctest
     1"""
    22all.py -- export of schemes to Sage
    33"""
    44
  • deleted file sage/schemes/generic/notes/divisor_stein-joyner.txt

    diff --git a/sage/schemes/generic/notes/divisor_stein-joyner.txt b/sage/schemes/generic/notes/divisor_stein-joyner.txt
    deleted file mode 100644
    + -  
    1 """nodoctest
    2 Divisors
    3 
    4 AUTHORS:
    5    -- William Stein
    6    -- David Kohel
    7    -- David Joyner
    8 
    9 EXAMPLES:
    10     sage: x,y,z = ProjectiveSpace(2, GF(5), names='xyz').gens()
    11     sage: C = Curve(y^2*z^7 - x^9 - x*z^8)
    12     sage: pts = C.rational_points(); pts
    13     [(0 : 0 : 1), (0 : 1 : 0), (2 : 2 : 1), (2 : 3 : 1), (3 : 1 : 1), (3 : 4 : 1)]
    14     sage: D = C.divisor(pts[0])*3 - C.divisor(pts[1]) + C.divisor(pts[5])*10; D
    15     3*(0 : 0 : 1) - (0 : 1 : 0) + 10*(3 : 4 : 1)
    16     sage: D[1][0]
    17     -1
    18     sage: D[1][1]
    19     (0 : 1 : 0)
    20     sage: C.divisor([(3, pts[0]), (-1, pts[1]), (10,pts[5])])
    21     3*(0 : 0 : 1) - (0 : 1 : 0) + 10*(3 : 4 : 1)
    22 """
    23 
    24 #*******************************************************************************
    25 #  Copyright (C) 2005 David Kohel <kohel@maths.usyd.edu.au>
    26 #  Copyright (C) 2005 William Stein
    27 #
    28 #  Distributed under the terms of the GNU General Public License (GPL)
    29 #
    30 #  The full text of the GPL is available at:
    31 #
    32 #                  http://www.gnu.org/licenses/
    33 #*******************************************************************************
    34 
    35 
    36 from sage.structure.all import FormalSum
    37 
    38 from sage.groups.group import AbelianGroup
    39 
    40 from sage.rings.all import Z
    41 
    42 class Divisor_generic(FormalSum):
    43     def scheme(self):
    44         """
    45         Return the scheme that this divisor is on.
    46 
    47         EXAMPLES:
    48             sage: x,y = AffineSpace(2, GF(5), names='xyz').gens()
    49             sage: C = Curve(y^2 - x^9 - x)
    50             sage: pts = C.rational_points(); pts
    51             [(0, 0), (2, 2), (2, 3), (3, 1), (3, 4)]
    52             sage: D = C.divisor(pts[0])*3 - C.divisor(pts[1]); D
    53             3*(0, 0) - (2, 2)
    54             sage: D.scheme()
    55             Closed subscheme of Affine Space of dimension 2 over
    56             Finite Field of size 5 defined by:
    57               xyz_1^2 + 4*xyz_0 + 4*xyz_0^9
    58         """
    59         return self.parent().scheme()
    60 
    61 class Divisor_curve_points(Divisor_generic):
    62     r"""
    63     For any curve $C$, use \code{C.divisor(v)} to construct a divisor
    64     on $C$.  Here $v$ can be either
    65     \begin{itemize}
    66        \item a rational point on $C$
    67        \item a list of rational points
    68        \item a list of 2-tuples $(c,P)$, where $c$ is
    69              an integer and $P$ is a rational point.
    70     \end{itemize}
    71 
    72     TODO: Divisors shouldn't be restricted to rational points.  The
    73     problem is that the divisor group is the formal sum of the group
    74     of points on the curve, and there's no implemented notion of point
    75     on $E/K$ that has coordinates in $L$.   This is what should
    76     be implemented, by adding an appropriate class to
    77     \code{schemes/generic/morphism.py}.
    78 
    79     EXAMPLES:
    80         sage: E = EllipticCurve([0, 0, 1, -1, 0])
    81         sage: P = E(0,0)
    82         sage: 10*P
    83         (161/16 : -2065/64 : 1)
    84         sage: D = E.divisor(P)
    85         sage: D
    86         (0 : 0 : 1)
    87         sage: 10*D
    88         10*(0 : 0 : 1)
    89         sage: E.divisor([P, P])
    90         2*(0 : 0 : 1)
    91         sage: E.divisor([(3,P), (-4,5*P)])
    92         3*(0 : 0 : 1) - 4*(1/4 : -5/8 : 1)
    93     """
    94     def __init__(self, v, check=True, reduce=True):
    95         """
    96         INPUT:
    97             v -- a list of pairs (c, P), where c is an integer
    98                  and P is a point on a curve.  The P's must
    99                  all lie on the same curve.
    100                  
    101         To create the 0 divisor use [(0, P)], so as to give
    102         the curve.
    103         """
    104         if not isinstance(v, (list, tuple)):
    105             v = [(1,v)]
    106 
    107         if len(v) < 1:
    108             raise ValueError, "v (=%s) must have length at least 1"%v
    109 
    110         if not (isinstance(v[0], tuple) and len(v[0]) == 2):
    111             C = v[0].scheme()
    112         else:
    113             C = v[0][1].scheme()
    114         if check:
    115             w = []
    116             for t in v:
    117                 if isinstance(t, tuple) and len(t) == 2:
    118                     w.append((Z(t[0]), C(t[1])))
    119                 else:
    120                     w.append((Z(1), C(t)))
    121             v = w
    122 
    123         Divisor_generic.__init__(self, v, check=False, reduce=True,
    124                                  parent = DivisorGroup(C))
    125 
    126        
    127 
    128 class DivisorGroup(AbelianGroup):
    129     def __init__(self, scheme):
    130         self.__scheme = scheme
    131 
    132     def _repr_(self):
    133         return "Group of Divisors on %s"%self.__scheme
    134 
    135     def __cmp__(self, right):
    136         if not isinstance(right, DivisorGroup):
    137             return -1
    138         return cmp(self.__scheme, right.__scheme)
    139 
    140     def scheme(self):
    141         return self.__scheme
    142 
    143 class DivisorGroup_curve_points(DivisorGroup):
    144     def __call__(self, v):
    145         return Divisor_curve_points(v)
    146        
  • sage/tests/all.py

    diff --git a/sage/tests/all.py b/sage/tests/all.py
    a b  
    1 """nodoctest
    2 """
    31from sage.modular.modsym.tests import Test as modsym
    42from sage.tests.arxiv_0812_2725 import *