Opened 15 months ago

Closed 14 months ago

Last modified 14 months ago

#26348 closed defect (fixed)

3 other internet doctests failing in findstat.py

Reported by: slabbe Owned by:
Priority: major Milestone: sage-8.5
Component: doctest coverage Keywords:
Cc: Merged in:
Authors: Martin Rubey Reviewers: Sébastien Labbé, Frédéric Chapoton
Report Upstream: N/A Work issues:
Branch: d35a6e3 (Commits) Commit: d35a6e3b9ff5ea1cd332dbb67aacc52d6f82d8fc
Dependencies: Stopgaps:

Description (last modified by slabbe)

As reported in sage-release for 8.4.beta6, the command

sage -tp --long --optional=sage,optional,external src/sage/databases/findstat.py

gives

sage -t --long src/sage/databases/findstat.py
**********************************************************************
File "src/sage/databases/findstat.py", line 106, in sage.databases.findstat
Failed example:
    r = findstat(Permutations, lambda pi: pi.saliances()[0]); r           # optional -- internet, random

    (St000051: The size of the left subtree. , [Mp00069: complement, Mp00061: to increasing tree], 24)
Exception raised:
    Traceback (most recent call last):
      File "/home/slabbe/GitBox/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 659, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/slabbe/GitBox/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 1068, in compile_and_execute
        compiled = compiler(example)
      File "/home/slabbe/GitBox/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 635, in compiler
        compileflags, 1)
      File "<doctest sage.databases.findstat[7]>", line 3
        (St000051: The size of the left subtree. , [Mp00069: complement, Mp00061: to increasing tree], Integer(24))
                 ^
    SyntaxError: invalid syntax
**********************************************************************
File "src/sage/databases/findstat.py", line 110, in sage.databases.findstat
Failed example:
    (s, list_f, quality) = next((a,b,c) for a,b,c in r if a.id() == 51)   # optional -- internet
Exception raised:
    Traceback (most recent call last):
      File "/home/slabbe/GitBox/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 659, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/slabbe/GitBox/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 1070, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.databases.findstat[8]>", line 1, in <module>
        (s, list_f, quality) = next((a,b,c) for a,b,c in r if a.id() == Integer(51))   # optional -- internet
    StopIteration
**********************************************************************
File "src/sage/databases/findstat.py", line 130, in sage.databases.findstat
Failed example:
    print(list_f[0].code() + "\r\n" + list_f[1].code())                   # optional -- internet, random
Exception raised:
    Traceback (most recent call last):
      File "/home/slabbe/GitBox/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 659, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/slabbe/GitBox/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 1070, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.databases.findstat[12]>", line 1, in <module>
        print(list_f[Integer(0)].code() + "\r\n" + list_f[Integer(1)].code())                   # optional -- internet, random
    IndexError: list index out of range
**********************************************************************
1 item had failures:
   3 of  16 in sage.databases.findstat
    7 webbrowser tests not run
    [247 tests, 3 failures, 72.88 s]

Change History (17)

comment:1 Changed 15 months ago by slabbe

  • Description modified (diff)

comment:2 Changed 15 months ago by mantepse

The first one seems to indicate that the meaning of "..." has changed: it fails because the next line is interpreted as part of the doctest instead of part of the output.

The other failures are a consequence of the first.

comment:3 Changed 15 months ago by mantepse

  • Branch set to u/mantepse/3_other_internet_doctests_failing_in_findstat_py

comment:4 Changed 15 months ago by mantepse

  • Authors set to Martin Rubey
  • Commit set to 6ed089bf7cde0d10f3eca170db4caa35b3ee306c
  • Status changed from new to needs_review

New commits:

6ed089bfix doctests, remove a few "random" tags

comment:5 Changed 14 months ago by chapoton

We should rather keep the #random, so that we do not have to change the doctests every week or so.

comment:6 Changed 14 months ago by slabbe

  • Reviewers set to Sébastien Labbé
  • Status changed from needs_review to positive_review

I suggest we update doctests and/or readd # random tag later in another ticket if needed. Positive review.

comment:7 follow-up: Changed 14 months ago by slabbe

  • Status changed from positive_review to needs_work

oups, the plugins "doctest continuation" seems unhappy. And sometimes pyflakes too.

comment:8 Changed 14 months ago by chapoton

pyflakes (when run using python3) warns about an exception class called StandardError? that has been removed in Python 3

Last edited 14 months ago by chapoton (previous) (diff)

comment:9 in reply to: ↑ 7 Changed 14 months ago by mantepse

Replying to slabbe:

oups, the plugins "doctest continuation" seems unhappy. And sometimes pyflakes too.

I do not understand this. It is complaining about the doctest which I just changed:

    sage: r = findstat(Permutations, lambda pi: pi.saliances()[0]); r           # optional -- internet
    0: ...
    ... (St000051: The size of the left subtree of a binary tree., [Mp00069: complement, Mp00061: to increasing tree], 1000)
    ...
    sage: (s, list_f, quality) = next((a,b,c) for a,b,c in r if a.id() == 51)   # optional -- internet

I can't see what's wrong with it - any ideas?

Concerning StandardError, it seems that this should be replaced with Exception.

comment:10 Changed 14 months ago by chapoton

The plugin is not smart. If you think it's ok, just go on.

comment:11 Changed 14 months ago by mantepse

Can I use or look at the plugin without setting up a patchbot?

comment:12 Changed 14 months ago by chapoton

The code is here: https://github.com/sagemath/sage-patchbot

Patchbot is not so easy to use. Some instructions for usage inside an ipython session are here at the bottom: https://wiki.sagemath.org/patchbot

comment:13 Changed 14 months ago by git

  • Commit changed from 6ed089bf7cde0d10f3eca170db4caa35b3ee306c to d35a6e3b9ff5ea1cd332dbb67aacc52d6f82d8fc

Branch pushed to git repo; I updated commit sha1. New commits:

d35a6e3StandardError -> Exception, no ... at beginning of line followed by whitespace

comment:14 Changed 14 months ago by mantepse

  • Status changed from needs_work to needs_review

comment:15 Changed 14 months ago by chapoton

  • Reviewers changed from Sébastien Labbé to Sébastien Labbé, Frédéric Chapoton
  • Status changed from needs_review to positive_review

ok, even if I would have prefered to keep "# random"

comment:16 Changed 14 months ago by vbraun

  • Branch changed from u/mantepse/3_other_internet_doctests_failing_in_findstat_py to d35a6e3b9ff5ea1cd332dbb67aacc52d6f82d8fc
  • Resolution set to fixed
  • Status changed from positive_review to closed

comment:17 Changed 14 months ago by embray

  • Milestone changed from sage-8.4 to sage-8.5

This should be re-targeted for 8.5.

Note: See TracTickets for help on using tickets.