sagemath / sage

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

make doctests of findstat more robust #36481

Closed mantepse closed 9 months ago

mantepse commented 1 year ago

Steps To Reproduce

Sébastien Labbé discovered some doctests failures with the following optional packages

--optional=4ti2,antic,build,cbc,ccache,cryptominisat,debian,dot2tex,e_antic,external,fricas,glucose,kissat,latte_int,lidia,normaliz,pip,sage,sage_numerical_backends_coin,sage_spkg

Expected Behavior

doctests should pass

Actual Behavior

sage -t --long --random-seed=115567904994049866192669758187637223396 src/sage/databases/findstat.py
**********************************************************************
File "src/sage/databases/findstat.py", line 4304, in sage.databases.findstat.?.in_range
Failed example:
    for c in sorted(l):                                           # optional -- internet
        if [c.id](http://c.id/)() not in long and c.is_supported():
            f = c.first_terms(lambda x: 1)
            print("{} {} {}".format(c, len(list(f)), all(c.in_range(e) for e, _ in f)))
Expected:
    Cc0001: Permutations 5913 True
    Cc0002: Integer partitions 1211 True
    Cc0005: Dyck paths 2055 True
    Cc0006: Integer compositions 1023 True
    Cc0007: Standard tableaux 1115 True
    Cc0009: Set partitions 1155 True
    Cc0010: Binary trees 2055 True
    Cc0012: Perfect matchings 1069 True
    Cc0013: Cores 100 True
    Cc0017: Alternating sign matrices 7917 True
    Cc0018: Gelfand-Tsetlin patterns 1409 True
    Cc0019: Semistandard tableaux 2374 True
    Cc0021: Ordered trees 2056 True
    Cc0022: Finite Cartan types 31 True
    Cc0023: Parking functions 18248 True
    Cc0024: Binary words 1022 True
    Cc0025: Plane partitions 1123 True
    Cc0026: Decorated permutations 2371 True
    Cc0027: Signed permutations 4282 True
    Cc0028: Skew partitions 1250 True
    Cc0029: Lattices 1378 True
Got:
    Cc0001: Permutations 5913 True
    Cc0002: Integer partitions 1211 True
    Cc0005: Dyck paths 2055 True
    Cc0006: Integer compositions 1023 True
    Cc0007: Standard tableaux 1115 True
    Cc0009: Set partitions 1155 True
    Cc0010: Binary trees 2055 True
    Cc0012: Perfect matchings 1069 True
    Cc0013: Cores 100 True
    Cc0017: Alternating sign matrices 7917 True
    Cc0018: Gelfand-Tsetlin patterns 1409 True
    Cc0019: Semistandard tableaux 2374 True
    Cc0021: Ordered trees 2056 True
    Cc0022: Finite Cartan types 31 True
    Cc0023: Parking functions 18248 True
    Cc0024: Binary words 1022 True
    Cc0025: Plane partitions 1123 True
    Cc0026: Decorated permutations 2371 True
    Cc0027: Signed permutations 4282 True
    Cc0028: Skew partitions 1250 True
    Cc0029: Lattices 1378 True
    Cc0030: Ordered set partitions 5316 True
**********************************************************************
File "src/sage/databases/findstat.py", line 4699, in sage.databases.findstat.FindStatCollections
Failed example:
    sorted(c for c in FindStatCollections() if c.is_supported())      # optional -- internet
Expected:
    [Cc0001: Permutations,
     Cc0002: Integer partitions,
     Cc0005: Dyck paths,
     Cc0006: Integer compositions,
     Cc0007: Standard tableaux,
     Cc0009: Set partitions,
     Cc0010: Binary trees,
     Cc0012: Perfect matchings,
     Cc0013: Cores,
     Cc0014: Posets,
     Cc0017: Alternating sign matrices,
     Cc0018: Gelfand-Tsetlin patterns,
     Cc0019: Semistandard tableaux,
     Cc0020: Graphs,
     Cc0021: Ordered trees,
     Cc0022: Finite Cartan types,
     Cc0023: Parking functions,
     Cc0024: Binary words,
     Cc0025: Plane partitions,
     Cc0026: Decorated permutations,
     Cc0027: Signed permutations,
     Cc0028: Skew partitions,
     Cc0029: Lattices]
Got:
    [Cc0001: Permutations,
     Cc0002: Integer partitions,
     Cc0005: Dyck paths,
     Cc0006: Integer compositions,
     Cc0007: Standard tableaux,
     Cc0009: Set partitions,
     Cc0010: Binary trees,
     Cc0012: Perfect matchings,
     Cc0013: Cores,
     Cc0014: Posets,
     Cc0017: Alternating sign matrices,
     Cc0018: Gelfand-Tsetlin patterns,
     Cc0019: Semistandard tableaux,
     Cc0020: Graphs,
     Cc0021: Ordered trees,
     Cc0022: Finite Cartan types,
     Cc0023: Parking functions,
     Cc0024: Binary words,
     Cc0025: Plane partitions,
     Cc0026: Decorated permutations,
     Cc0027: Signed permutations,
     Cc0028: Skew partitions,
     Cc0029: Lattices,
     Cc0030: Ordered set partitions]
**********************************************************************
File "src/sage/databases/findstat.py", line 4775, in sage.databases.findstat.FindStatCollections._element_constructor_
Failed example:
    sorted([FindStatCollection(c.first_terms(lambda x: 0)[0][0]) for c in FindStatCollections() if c.is_supported()]) # optional -- internet
Expected:
    [Cc0001: Permutations,
     Cc0002: Integer partitions,
     Cc0005: Dyck paths,
     Cc0006: Integer compositions,
     Cc0007: Standard tableaux,
     Cc0009: Set partitions,
     Cc0010: Binary trees,
     Cc0012: Perfect matchings,
     Cc0013: Cores,
     Cc0014: Posets,
     Cc0017: Alternating sign matrices,
     Cc0018: Gelfand-Tsetlin patterns,
     Cc0019: Semistandard tableaux,
     Cc0020: Graphs,
     Cc0021: Ordered trees,
     Cc0022: Finite Cartan types,
     Cc0023: Parking functions,
     Cc0024: Binary words,
     Cc0025: Plane partitions,
     Cc0026: Decorated permutations,
     Cc0027: Signed permutations,
     Cc0028: Skew partitions,
     Cc0029: Lattices]
Got:
    [Cc0001: Permutations,
     Cc0002: Integer partitions,
     Cc0005: Dyck paths,
     Cc0006: Integer compositions,
     Cc0007: Standard tableaux,
     Cc0009: Set partitions,
     Cc0010: Binary trees,
     Cc0012: Perfect matchings,
     Cc0013: Cores,
     Cc0014: Posets,
     Cc0017: Alternating sign matrices,
     Cc0018: Gelfand-Tsetlin patterns,
     Cc0019: Semistandard tableaux,
     Cc0020: Graphs,
     Cc0021: Ordered trees,
     Cc0022: Finite Cartan types,
     Cc0023: Parking functions,
     Cc0024: Binary words,
     Cc0025: Plane partitions,
     Cc0026: Decorated permutations,
     Cc0027: Signed permutations,
     Cc0028: Skew partitions,
     Cc0029: Lattices,
     Cc0030: Ordered set partitions]
**********************************************************************
3 items had failures:
   1 of  10 in sage.databases.findstat.?.in_range
   1 of   3 in sage.databases.findstat.FindStatCollections
   1 of  15 in sage.databases.findstat.FindStatCollections._element_constructor_
    11 webbrowser tests not run
    0 tests not run because we ran out of time
    [428 tests, 3 failures, 76.43 s]

Additional Information

The doctests simply fail because there is a new collection.

Environment

- **OS**: Ubuntu 18.04
- **Sage Version**: 10.2.beta6

Checklist

harivamsi9 commented 1 year ago

hey I am new to this org. can I take this as my first issue? or do you suggest elsewhere I could start contributing

mantepse commented 1 year ago

This is a good place to start! Welcome to Sage! Can you reproduce the doctest failure already on your machine?