Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3 other internet doctests failing in findstat.py #26348

Closed
seblabbe opened this issue Sep 26, 2018 · 21 comments
Closed

3 other internet doctests failing in findstat.py #26348

seblabbe opened this issue Sep 26, 2018 · 21 comments

Comments

@seblabbe
Copy link
Contributor

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]

Component: doctest coverage

Author: Martin Rubey

Branch/Commit: d35a6e3

Reviewer: Sébastien Labbé, Frédéric Chapoton

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

@seblabbe seblabbe added this to the sage-8.4 milestone Sep 26, 2018
@seblabbe

This comment has been minimized.

@mantepse
Copy link
Collaborator

comment:2

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.

@mantepse
Copy link
Collaborator

@mantepse
Copy link
Collaborator

Author: Martin Rubey

@mantepse
Copy link
Collaborator

Commit: 6ed089b

@mantepse
Copy link
Collaborator

New commits:

6ed089bfix doctests, remove a few "random" tags

@fchapoton
Copy link
Contributor

comment:5

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

@seblabbe
Copy link
Contributor Author

seblabbe commented Oct 8, 2018

comment:6

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

@seblabbe
Copy link
Contributor Author

seblabbe commented Oct 8, 2018

Reviewer: Sébastien Labbé

@seblabbe
Copy link
Contributor Author

seblabbe commented Oct 8, 2018

comment:7

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

@fchapoton
Copy link
Contributor

comment:8

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

@mantepse
Copy link
Collaborator

mantepse commented Oct 8, 2018

comment:9

Replying to @seblabbe:

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.

@fchapoton
Copy link
Contributor

comment:10

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

@mantepse
Copy link
Collaborator

mantepse commented Oct 9, 2018

comment:11

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

@fchapoton
Copy link
Contributor

comment:12

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

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 9, 2018

Changed commit from 6ed089b to d35a6e3

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 9, 2018

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

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

@fchapoton
Copy link
Contributor

Changed reviewer from Sébastien Labbé to Sébastien Labbé, Frédéric Chapoton

@fchapoton
Copy link
Contributor

comment:15

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

@vbraun
Copy link
Member

vbraun commented Oct 20, 2018

@embray
Copy link
Contributor

embray commented Oct 28, 2018

comment:17

This should be re-targeted for 8.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants