Ticket #13062: 13062_nodoctest_review.patch
File 13062_nodoctest_review.patch, 10.8 KB (added by , 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 856 856 It is also immediately clear to the user that the indicated example 857 857 does not currently work. 858 858 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 859 868 - If a line contains ``# optional - PKGNAME`` (where the ``#`` may be any 860 869 non-letter non-space character), it is not tested unless 861 870 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 11 11 # http://www.gnu.org/licenses/ 12 12 ############################################################################# 13 13 14 """nodoctest"""15 16 14 sage_mode = 'cmdline' 17 15 18 16 try: -
sage/all_notebook.py
diff --git a/sage/all_notebook.py b/sage/all_notebook.py
a b 1 """nodoctest"""2 3 1 from sage.all import * 4 2 preparser(on=True) 5 3 -
sage/databases/all.py
diff --git a/sage/databases/all.py b/sage/databases/all.py
a b 1 """ nodoctest1 """ 2 2 This file gathers together all the tables in Sage. 3 3 4 * ConwayPolynomials -- database of selected Conway polynomials.4 * ConwayPolynomials() -- database of selected Conway polynomials. 5 5 6 6 * CremonaDatabase() - Cremona's tables of elliptic curves and related data. 7 7 8 * Gamma0Wt2Database() -- table of arithmetic information about9 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. 10 10 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. 16 13 17 14 * Sloane's tables -- sloane_sequence, sloane_find 18 15 19 16 * SymbolicData() -- many benchmark and testing ideals 20 17 21 * Symbolic Data -- benchmark and test ideals 18 EXAMPLES:: 22 19 23 EXAMPLES:24 20 sage: ConwayPolynomials() 25 21 Frank Luebeck's database of Conway polynomials 26 22 27 23 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... 32 25 33 26 sage: JonesDatabase() 34 27 John Jones's table of number fields with bounded ramification and degree <= 6 35 28 36 sage: SteinWatkinsDatabase()37 The Stein-Watkins database of elliptic curves38 39 29 sage: SymbolicData() 40 SymbolicData with 372 ideals 41 30 SymbolicData with ... ideals 42 31 """ 43 32 44 33 #***************************************************************************** 45 # Sage: System for Algebra and Geometry Experimentation46 #47 34 # Copyright (C) 2005 William Stein <wstein@gmail.com> 48 35 # 49 36 # 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. 58 39 # http://www.gnu.org/licenses/ 59 40 #***************************************************************************** 60 41 42 61 43 from sql_db import SQLQuery, SQLDatabase 62 44 63 45 from conway import ConwayPolynomials -
sage/databases/lincodes.py
diff --git a/sage/databases/lincodes.py b/sage/databases/lincodes.py
a b 1 """ nodoctest1 """ 2 2 Linear codes 3 3 """ 4 4 -
sage/doctest/control.py
diff --git a/sage/doctest/control.py b/sage/doctest/control.py
a b 27 27 from reporting import DocTestReporter 28 28 from util import NestedName, Timer, count_noun, dict_difference 29 29 30 nodoctest_regex = re.compile(r'\s*(#+|%+| \.\.)\s*nodoctest')30 nodoctest_regex = re.compile(r'\s*(#+|%+|r"+|"+|\.\.)\s*nodoctest') 31 31 32 32 class DocTestDefaults(SageObject): 33 33 """ … … 430 430 sage: DC.expand_files_into_sources() 431 431 sage: DC.sources 432 432 [] 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 433 442 """ 434 443 def skipdir(dirname): 435 444 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 """ nodoctest1 """ 2 2 all.py -- export of schemes to Sage 3 3 """ 4 4 -
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 """nodoctest2 Divisors3 4 AUTHORS:5 -- William Stein6 -- David Kohel7 -- David Joyner8 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(); pts13 [(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; D15 3*(0 : 0 : 1) - (0 : 1 : 0) + 10*(3 : 4 : 1)16 sage: D[1][0]17 -118 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 Stein27 #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 FormalSum37 38 from sage.groups.group import AbelianGroup39 40 from sage.rings.all import Z41 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(); pts51 [(0, 0), (2, 2), (2, 3), (3, 1), (3, 4)]52 sage: D = C.divisor(pts[0])*3 - C.divisor(pts[1]); D53 3*(0, 0) - (2, 2)54 sage: D.scheme()55 Closed subscheme of Affine Space of dimension 2 over56 Finite Field of size 5 defined by:57 xyz_1^2 + 4*xyz_0 + 4*xyz_0^958 """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 divisor64 on $C$. Here $v$ can be either65 \begin{itemize}66 \item a rational point on $C$67 \item a list of rational points68 \item a list of 2-tuples $(c,P)$, where $c$ is69 an integer and $P$ is a rational point.70 \end{itemize}71 72 TODO: Divisors shouldn't be restricted to rational points. The73 problem is that the divisor group is the formal sum of the group74 of points on the curve, and there's no implemented notion of point75 on $E/K$ that has coordinates in $L$. This is what should76 be implemented, by adding an appropriate class to77 \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*P83 (161/16 : -2065/64 : 1)84 sage: D = E.divisor(P)85 sage: D86 (0 : 0 : 1)87 sage: 10*D88 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 integer98 and P is a point on a curve. The P's must99 all lie on the same curve.100 101 To create the 0 divisor use [(0, P)], so as to give102 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"%v109 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 = w122 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 = scheme131 132 def _repr_(self):133 return "Group of Divisors on %s"%self.__scheme134 135 def __cmp__(self, right):136 if not isinstance(right, DivisorGroup):137 return -1138 return cmp(self.__scheme, right.__scheme)139 140 def scheme(self):141 return self.__scheme142 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 """nodoctest2 """3 1 from sage.modular.modsym.tests import Test as modsym 4 2 from sage.tests.arxiv_0812_2725 import *