sagemath / sage

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

9 internet doctests failing in src/sage/databases/findstat.py #32694

Closed seblabbe closed 2 years ago

seblabbe commented 3 years ago

On Ubuntu 18.04 running 9.5.beta3, the command

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

gives

Using --optional=internet,sage
Doctesting 1 file.
sage -t --random-seed=0 src/sage/databases/findstat.py
**********************************************************************
File "src/sage/databases/findstat.py", line 49, in sage.databases.findstat
Failed example:
    r = findstat([(m, m.number_of_nestings()) for n in range(6) for m in PM(2*n)]); r # optional -- internet
Expected:
    0: St000042oMp00116 (quality [100, 100])
    1: St000041 (quality [20, 100])
    ...
Got:
     0: St000042oMp00116 (quality [100, 100])
     1: St000042oMp00113oMp00116 (quality [100, 100])
     2: St000042oMp00116oMp00113 (quality [100, 100])
     3: St000042oMp00144oMp00116 (quality [100, 100])
     4: St000042oMp00145oMp00116 (quality [100, 100])
     5: St000041 (quality [20, 100])
     6: St000041oMp00113 (quality [20, 100])
     7: St000233oMp00092 (quality [16, 100])
     8: St000496oMp00092 (quality [16, 100])
     9: St000233oMp00112oMp00092 (quality [16, 100])
    10: St000496oMp00112oMp00092 (quality [16, 100])
    11: St000123oMp00087oMp00058 (quality [13, 70])
    12: St000232oMp00115oMp00092 (quality [13, 70])
    13: St000359oMp00087oMp00058 (quality [13, 70])
**********************************************************************
File "src/sage/databases/findstat.py", line 82, in sage.databases.findstat
Failed example:
    print(r[1].statistic().description())                                 # optional -- internet
Expected:
    The number of nestings of a perfect matching.
    <BLANKLINE>
    <BLANKLINE>
    This is the number of pairs of edges $((a,b), (c,d))$ such that $a\le c\le d\le b$. i.e., the edge $(c,d)$ is nested inside $(a,b)$...
Got:
    The number of crossings of a perfect matching. 

    This is the number of pairs of edges $((a,b),(c,d))$ such that $a\le c\le b\le d$, i.e., the edges $(a,b)$ and $(c,d)$ cross when drawing the perfect matching as a chord diagram.

    The generating function for perfect matchings $M$ of $\{1,\dots,2n\}$ according to the number of crossings $\textrm{cr}(M)$ is given by the Touchard-Riordan formula ([2], [4], a bijective proof is given in [7]):
    $$
    \sum_{M} q^{\textrm{cr}(M)}
    = \frac{1}{(1-q)^n} \sum_{k=0}^n\left(\binom{2n}{n-k}-\binom{2n}{n-k-1}\right)(-1)^k q^{\binom{k+1}{2}}
    $$
    <BLANKLINE>
**********************************************************************
File "src/sage/databases/findstat.py", line 90, in sage.databases.findstat
Failed example:
    r[1].statistic().references()                                         # optional -- internet
Expected:
    0: [1]  de Médicis, A., Viennot, X. G., Moments des $q$-polynômes de Laguerre et la bijection de Foata-Zeilberger [[MathSciNet:1288802]]
    1: [2]  Simion, R., Stanton, D., Octabasic Laguerre polynomials and permutation statistics [[MathSciNet:1418763]]...
Got:
    0: [1]  de Médicis, A., Viennot, X. G., Moments des $q$-polynômes de Laguerre et la bijection de Foata-Zeilberger [[MathSciNet:1288802]]
    1: [2]  Riordan, J., The distribution of crossings of chords joining pairs of $2n$ points on a circle [[MathSciNet:0366686]]
    2: [3]  Simion, R., Stanton, D., Octabasic Laguerre polynomials and permutation statistics [[MathSciNet:1418763]]
    3: [4]  Touchard, J., Sur un problème de configurations et sur les fractions continues [[MathSciNet:0046325]]
    4: [5]  Josuat-Vergès, M., Rubey, M., Crossings, Motzkin paths and moments [[MathSciNet:2819649]]
    5: [6]  Triangle read by rows: T(n,k) gives number of ways of arranging n chords on a circle with k simple intersections (i.e. no intersections with 3 or more chords) - positive values only. [[OEIS:A067311]]
    6: [7]  Penaud, J.-G., Une preuve bijective d'une formule de Touchard-Riordan [[MathSciNet:1336847]]
**********************************************************************
File "src/sage/databases/findstat.py", line 118, in sage.databases.findstat
Failed example:
    r = findstat(Permutations, lambda pi: pi.saliances()[0], depth=2); r  # optional -- internet
Expected:
    0: St000740oMp00066 with offset 1 (quality [100, 100])
    ...
    7: St000051oMp00061oMp00069 (quality [87, 86])
    ...
Got:
     0: St000740oMp00087 with offset 1 (quality [100, 100])
     1: St000740oMp00066 with offset 1 (quality [100, 100])
     2: St000476oMp00099oMp00127 (quality [100, 100])
     3: St000740oMp00236oMp00066 with offset 1 (quality [100, 100])
     4: St000740oMp00238oMp00066 with offset 1 (quality [100, 100])
     5: St000740oMp00089oMp00149 with offset 1 (quality [100, 100])
     6: St000740oMp00238oMp00087 with offset 1 (quality [100, 100])
     7: St000740oMp00236oMp00087 with offset 1 (quality [100, 100])
     8: St000740oMp00067oMp00062 with offset 1 (quality [99, 100])
     9: St000147oMp00027oMp00127 (quality [96, 100])
    10: St000740oMp00175oMp00062 with offset 1 (quality [91, 100])
    11: St000054oMp00066oMp00149 with offset 1 (quality [89, 100])
    12: St000054oMp00064oMp00062 with offset 1 (quality [88, 100])
    13: St000740oMp00175oMp00087 with offset 1 (quality [88, 100])
    14: St000740oMp00067oMp00087 with offset 1 (quality [88, 100])
    15: St000740oMp00175oMp00066 with offset 1 (quality [88, 100])
    16: St000740oMp00067oMp00066 with offset 1 (quality [88, 100])
    17: St000740oMp00062 with offset 1 (quality [87, 100])
    18: St000054oMp00064oMp00087 with offset 1 (quality [87, 100])
    19: St000054oMp00025oMp00127 with offset 1 (quality [87, 100])
    20: St000054oMp00064oMp00066 with offset 1 (quality [87, 100])
    21: St000141oMp00025oMp00127 (quality [87, 100])
    22: St000740oMp00238oMp00062 with offset 1 (quality [87, 100])
    23: St000740oMp00236oMp00062 with offset 1 (quality [87, 100])
    24: St001291oMp00127 with offset 1 (quality [87, 86])
    25: St000051oMp00061oMp00069 (quality [87, 86])
    26: St000051oMp00061oMp00149 (quality [87, 86])
    27: St000316oMp00025oMp00127 (quality [87, 86])
    28: St000653oMp00129oMp00127 (quality [87, 86])
    29: St000740oMp00089oMp00069 with offset 1 (quality [87, 86])
    30: St001184oMp00127oMp00064 with offset 1 (quality [87, 86])
    31: St001227oMp00028oMp00127 (quality [87, 86])
    32: St001291oMp00132oMp00127 with offset 1 (quality [87, 86])
    33: St001291oMp00124oMp00127 with offset 1 (quality [87, 86])
    34: St001291oMp00099oMp00127 with offset 1 (quality [87, 86])
    35: St001480oMp00118oMp00127 (quality [87, 86])
    36: St001480oMp00032oMp00127 (quality [87, 86])
    37: St000066oMp00063oMp00149 with offset 1 (quality [54, 86])
    38: St000066oMp00063oMp00069 with offset 1 (quality [54, 86])
    39: St000840oMp00146oMp00127 (quality [18, 86])
    40: St000199oMp00063 with offset 1 (quality [15, 71])
    41: St000193oMp00004oMp00063 with offset 1 (quality [15, 71])
    42: St000199oMp00137oMp00127 with offset 1 (quality [15, 71])
    43: St000200oMp00063oMp00062 with offset 1 (quality [15, 71])
    44: St000200oMp00005oMp00063 with offset 1 (quality [15, 71])
    45: St000200oMp00063oMp00087 with offset 1 (quality [15, 71])
    46: St000200oMp00035oMp00127 with offset 1 (quality [15, 71])
    47: St000200oMp00137oMp00127 with offset 1 (quality [15, 71])
    48: St000740oMp00201oMp00127 with offset 1 (quality [15, 71])
    49: St001291oMp00199oMp00127 with offset 1 (quality [15, 71])
**********************************************************************
File "src/sage/databases/findstat.py", line 127, in sage.databases.findstat
Failed example:
    r[0].info()                                                           # optional -- internet
Expected:
    after adding 1 to every value
    and applying
        Mp00066: inverse: Permutations -> Permutations
    to the objects (see `.compound_map()` for details)
    <BLANKLINE>
    your input matches
        St000740: The last entry of a permutation.
    <BLANKLINE>
    among the values you sent, 100 percent are actually in the database,
    among the distinct values you sent, 100 percent are actually in the database
Got:
    after adding 1 to every value
    and applying
        Mp00087: inverse first fundamental transformation: Permutations -> Permutations
    to the objects (see `.compound_map()` for details)
    <BLANKLINE>
    your input matches
        St000740: The last entry of a permutation.
    <BLANKLINE>
    among the values you sent, 100 percent are actually in the database,
    among the distinct values you sent, 100 percent are actually in the database
**********************************************************************
File "src/sage/databases/findstat.py", line 1053, in sage.databases.findstat.?
Failed example:
    findstat("graphs", lambda g: g.diameter() if g.is_connected() else None, max_values=100) # optional -- internet
Expected:
    0: St000259 (quality [100, 100])
Got:
    0: St000259 (quality [100, 100])
    1: St000259oMp00111oMp00157 (quality [61, 83])
    2: St000259oMp00157oMp00111 (quality [61, 83])
**********************************************************************
File "src/sage/databases/findstat.py", line 1231, in sage.databases.findstat.findmap
Failed example:
    q = findmap([(pi, pi.complement().increasing_tree_shape()) for pi in l], depth=2); q  # optional -- internet
Expected:
    0: Mp00061oMp00069 (quality [100])
Got:
    0: Mp00061oMp00069 (quality [97])
**********************************************************************
File "src/sage/databases/findstat.py", line 1236, in sage.databases.findstat.findmap
Failed example:
    p = findmap({pi: pi.complement().increasing_tree_shape() for pi in l}, depth=2); p    # optional -- internet
Expected:
    0: Mp00061oMp00069 (quality [100])
Got:
    0: Mp00061oMp00069 (quality [97])
**********************************************************************
File "src/sage/databases/findstat.py", line 2538, in sage.databases.findstat.FindStatStatisticQuery.?
Failed example:
    FindStatStatisticQuery(domain=12, data=data, depth=1)         # optional -- internet
Expected:
    0: St000041 (quality [99, 100])
    1: St000042oMp00116 (quality [99, 100])
    2: St000233oMp00092 (quality [99, 100])
    3: St000496oMp00092 (quality [99, 100])
    4: St001513oMp00058 (quality [15, 57])
Got:
    0: St000041 (quality [99, 100])
    1: St000041oMp00113 (quality [99, 100])
    2: St000042oMp00116 (quality [99, 100])
    3: St000233oMp00092 (quality [99, 100])
    4: St000496oMp00092 (quality [99, 100])
    5: St001513oMp00058 (quality [15, 57])
**********************************************************************
4 items had failures:
   5 of  17 in sage.databases.findstat
   1 of  42 in sage.databases.findstat.?
   1 of   4 in sage.databases.findstat.FindStatStatisticQuery.?
   2 of  12 in sage.databases.findstat.findmap
    [395 tests, 9 failures, 44.89 s]
----------------------------------------------------------------------
sage -t --random-seed=0 src/sage/databases/findstat.py  # 9 doctests failed
----------------------------------------------------------------------

Maybe it is time to think about how to make those doctests more robust. We need to keep fixing them all of the time.

CC: @mantepse

Component: doctest coverage

Keywords: findstat

Author: Martin Rubey

Branch/Commit: f0e5f85

Reviewer: Sébastien Labbé

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

mantepse commented 3 years ago

Changed keywords from none to findstat

mantepse commented 2 years ago

Branch: u/mantepse/9_internet_doctests_failing_in_src_sage_databases_findstat_py

mantepse commented 2 years ago
comment:3

I made the doctests slightly more robust. The reason they failed is a massive restructuring of the findstat search engine.

To do so, I also added info methods for the other user visible classes, which also makes the interface more uniform.


New commits:

f0e5f85fix doctests and add info method
mantepse commented 2 years ago

Commit: f0e5f85

mantepse commented 2 years ago

Author: Martin Rubey

seblabbe commented 2 years ago

Reviewer: Sébastien Labbé

seblabbe commented 2 years ago
comment:5

Greenbot + all tests passed with internet.

vbraun commented 2 years ago

Changed branch from u/mantepse/9_internet_doctests_failing_in_src_sage_databases_findstat_py to f0e5f85