sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.38k stars 470 forks source link

1 doctest failing in oeis.py #33943

Closed seblabbe closed 2 years ago

seblabbe commented 2 years ago

On Ubuntu 20.04 + SageMath version 9.7.beta1, Release Date: 2022-05-26 , the command

sage -t --optional=sage,internet src/sage/databases/oeis.py 

gives

Using --optional=internet,sage
Features to be detected: 4ti2,benzene,bliss,buckygen,conway_polynomials,csdp,database_cremona_ellcurve,database_cremona_mini_ellcurve,database_jones_numfield,database_knotinfo,dvipng,gfan,graphviz,imagemagick,jupymake,kenzo,latte_int,lrslib,mcqd,meataxe,msolve,nauty,palp,pandoc,pdf2svg,pdftocairo,phitigra,plantri,polytopes_db,polytopes_db_4d,pynormaliz,python_igraph,rubiks,sage.combinat,sage.geometry.polyhedron,sage.graphs,sage.groups,sage.plot,sage.rings.number_field,sage.rings.padics,sage.rings.real_double,sage.symbolic,sage_numerical_backends_coin,sagemath_doc_html,sphinx,tdlib
Doctesting 1 file.
sage -t --random-seed=3922102010001695725205669432739579005 src/sage/databases/oeis.py
**********************************************************************
File "src/sage/databases/oeis.py", line 129, in sage.databases.oeis
Failed example:
    [i for i in b.comments() if 'prime' in i][-1]     # optional -- internet
Expected:
    'Number n is prime if mod(a(n)-2,n) = 0...'
Got:
    'Number n is prime if (a(n)-2) mod n = 0. - _Dmitry Kruchinin_, Feb 14 2012 - Incorrect; see 2007 comment by David W. Wilson above. - _Jeppe Stig Nielsen_, Apr 22 2022'
**********************************************************************
1 item had failures:
   1 of  26 in sage.databases.oeis
    [289 tests, 1 failure, 34.73 s]
----------------------------------------------------------------------
sage -t --random-seed=3922102010001695725205669432739579005 src/sage/databases/oeis.py  # 1 doctest failed
----------------------------------------------------------------------

Component: doctest coverage

Author: Frédéric Chapoton

Branch/Commit: 2332517

Reviewer: Sébastien Labbé

Issue created by migration from https://trac.sagemath.org/ticket/33943

fchapoton commented 2 years ago

Author: Frédéric Chapoton

fchapoton commented 2 years ago

Commit: 2332517

fchapoton commented 2 years ago

New commits:

2332517fix details in oeis
fchapoton commented 2 years ago

Branch: u/chapoton/33943

fchapoton commented 2 years ago
comment:2

le patchbot est moralement vert

seblabbe commented 2 years ago
comment:3

J'obtiens ceci, c'est curieux?

$ sage -t --optional=sage,internet src/sage/databases/oeis.py 
too many failed tests, not using stored timings
Running doctests with ID 2022-06-02-12-00-39-0936226b.
Git branch: 33943
Using --optional=internet,sage
Features to be detected: 4ti2,benzene,bliss,buckygen,conway_polynomials,csdp,database_cremona_ellcurve,database_cremona_mini_ellcurve,database_jones_numfield,database_knotinfo,dvipng,gfan,graphviz,imagemagick,jupymake,kenzo,latte_int,lrslib,mcqd,meataxe,msolve,nauty,palp,pandoc,pdf2svg,pdftocairo,phitigra,plantri,polytopes_db,polytopes_db_4d,pynormaliz,python_igraph,rubiks,sage.combinat,sage.geometry.polyhedron,sage.graphs,sage.groups,sage.plot,sage.rings.number_field,sage.rings.padics,sage.rings.real_double,sage.symbolic,sage_numerical_backends_coin,sagemath_doc_html,sphinx,tdlib
Doctesting 1 file.
sage -t --random-seed=199068304958900194905303414723157212023 src/sage/databases/oeis.py
**********************************************************************
File "src/sage/databases/oeis.py", line 1361, in sage.databases.oeis.OEISSequence.__call__
Failed example:
    s(2)
Expected:
    Traceback (most recent call last):
    ...
    ValueError: sequence A999999 is not defined (or known) for index 2
Got:
    <BLANKLINE>
    Traceback (most recent call last):
      File "/home/slabbe/GitBox/sage/local/var/lib/sage/venv-python3.8/lib/python3.8/site-packages/sage/doctest/forker.py", line 695, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/slabbe/GitBox/sage/local/var/lib/sage/venv-python3.8/lib/python3.8/site-packages/sage/doctest/forker.py", line 1093, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.databases.oeis.OEISSequence.__call__[11]>", line 1, in <module>
        s(Integer(2))
      File "/home/slabbe/GitBox/sage/local/var/lib/sage/venv-python3.8/lib/python3.8/site-packages/sage/databases/oeis.py", line 1375, in __call__
        raise ValueError("Sequence %s is not defined (or known) for index %s" % (self.id(), k))
    ValueError: Sequence A999999 is not defined (or known) for index 2
**********************************************************************
File "src/sage/databases/oeis.py", line 1450, in sage.databases.oeis.OEISSequence.__iter__
Failed example:
    next(i)                               # optional -- internet
Expected:
    Traceback (most recent call last):
    ...
    LookupError: future values not provided by OEIS
Got:
    <BLANKLINE>
    Traceback (most recent call last):
      File "/home/slabbe/GitBox/sage/local/var/lib/sage/venv-python3.8/lib/python3.8/site-packages/sage/doctest/forker.py", line 695, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/slabbe/GitBox/sage/local/var/lib/sage/venv-python3.8/lib/python3.8/site-packages/sage/doctest/forker.py", line 1093, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.databases.oeis.OEISSequence.__iter__[7]>", line 1, in <module>
        next(i)                               # optional -- internet
      File "/home/slabbe/GitBox/sage/local/var/lib/sage/venv-python3.8/lib/python3.8/site-packages/sage/databases/oeis.py", line 1491, in __iter__
        raise LookupError("Future values not provided by OEIS.")
    LookupError: Future values not provided by OEIS.
**********************************************************************
File "src/sage/databases/oeis.py", line 1460, in sage.databases.oeis.OEISSequence.__iter__
Failed example:
    for i in f:                           # optional -- internet
        print(i)
Expected:
    Traceback (most recent call last):
    ...
    LookupError: future values not provided by OEIS
Got:
    0
    1
    1
    2
    3
    5
    8
    13
    21
    34
    55
    89
    144
    233
    377
    610
    987
    1597
    2584
    4181
    6765
    10946
    17711
    28657
    46368
    75025
    121393
    196418
    317811
    514229
    832040
    1346269
    2178309
    3524578
    5702887
    9227465
    14930352
    24157817
    39088169
    63245986
    102334155
    Traceback (most recent call last):
      File "/home/slabbe/GitBox/sage/local/var/lib/sage/venv-python3.8/lib/python3.8/site-packages/sage/doctest/forker.py", line 695, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/slabbe/GitBox/sage/local/var/lib/sage/venv-python3.8/lib/python3.8/site-packages/sage/doctest/forker.py", line 1093, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.databases.oeis.OEISSequence.__iter__[9]>", line 1, in <module>
        for i in f:                           # optional -- internet
      File "/home/slabbe/GitBox/sage/local/var/lib/sage/venv-python3.8/lib/python3.8/site-packages/sage/databases/oeis.py", line 1491, in __iter__
        raise LookupError("Future values not provided by OEIS.")
    LookupError: Future values not provided by OEIS.
**********************************************************************
File "src/sage/databases/oeis.py", line 1469, in sage.databases.oeis.OEISSequence.__iter__
Failed example:
    for i in s:
        pass
Expected:
    Traceback (most recent call last):
    ...
    LookupError: future values not provided by OEIS
Got:
    <BLANKLINE>
    Traceback (most recent call last):
      File "/home/slabbe/GitBox/sage/local/var/lib/sage/venv-python3.8/lib/python3.8/site-packages/sage/doctest/forker.py", line 695, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/slabbe/GitBox/sage/local/var/lib/sage/venv-python3.8/lib/python3.8/site-packages/sage/doctest/forker.py", line 1093, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.databases.oeis.OEISSequence.__iter__[11]>", line 1, in <module>
        for i in s:
      File "/home/slabbe/GitBox/sage/local/var/lib/sage/venv-python3.8/lib/python3.8/site-packages/sage/databases/oeis.py", line 1491, in __iter__
        raise LookupError("Future values not provided by OEIS.")
    LookupError: Future values not provided by OEIS.
**********************************************************************
File "src/sage/databases/oeis.py", line 1884, in sage.databases.oeis.OEISSequence.programs
Failed example:
    s.programs()
Expected:
    [('maple', ...),
    ('mathematica', ...),
    ('python',
    0: def A999999(n):
    1:     assert(isinstance(n, (int, Integer))), "n must be an integer."
    2:     if n < 38:
    3:         raise ValueError("the value %s is not accepted" % str(n))
    4:     elif n == 42:
    5:         return 2
    6:     else:
    7:         return 1)]
Got:
    [('maple', 0: Do not even try, Maple is not able to produce such a sequence.),
     ('mathematica', 0: Mathematica neither.),
     ('python',
      0: def A999999(n):
      1:     assert(isinstance(n, (int, Integer))), "n must be an integer."
      2:     if n < 38:
      3:         raise ValueError("The value %s is not accepted." %str(n))
      4:     elif n == 42:
      5:         return 2
      6:     else:
      7:         return 1)]
**********************************************************************
3 items had failures:
   1 of  13 in sage.databases.oeis.OEISSequence.__call__
   3 of  16 in sage.databases.oeis.OEISSequence.__iter__
   1 of   9 in sage.databases.oeis.OEISSequence.programs
    [289 tests, 5 failures, 38.64 s]
----------------------------------------------------------------------
sage -t --random-seed=199068304958900194905303414723157212023 src/sage/databases/oeis.py  # 5 doctests failed
----------------------------------------------------------------------
fchapoton commented 2 years ago
comment:4

peut-etre oublié de faire "sage -b" avant ?

seblabbe commented 2 years ago
comment:5

Oui, c'est ça. J'ai tenté de faire le review rapidement hier à midi moins une à la fin des Sage Thursday's in Bordeaux. Je m'étais dit que comme ça corrigeait que les doctest, je pouvais me risquer à faire sans le sage -b.

I confirm it fixes the doctest:

    [289 tests, 47.89 s]
----------------------------------------------------------------------
All tests passed!
----------------------------------------------------------------------
mkoeppe commented 2 years ago
comment:6

reviewer name

fchapoton commented 2 years ago

Reviewer: Sébastien Labbé

vbraun commented 2 years ago

Changed branch from u/chapoton/33943 to 2332517