sagemath/sage

Make sets doctests ready for random seeds

Closed this issue · 12 comments

kliem commented

This ticket makes

sage -t --long --random-seed=n src/sage/sets/

pass for different values n than just 0.

Depends on #29962

Component: doctest framework

Author: Dave Morris

Branch/Commit: aae7813

Reviewer: Jonathan Kliem

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

kliem commented
comment:1

At least the following needs to be fixed:

sage -t --long --random_seed=151058820726654196682836430928254760259 src/sage/sets/finite_enumerated_set.py  # 1 doctest failed
kliem commented

Dependencies: #29962

Author: Dave Morris

comment:4

I added a # random tag to the example that failed in comment:1 (and also added a basic doctest S.random_element() in S to the random_element() method of FiniteEnumeratedSet ). I tried a few various seeds and have not seen any other doctest failures.


New commits:

aae7813trac 29973 random enumerated sets
comment:5

After submitting the PR, I noticed that #29935 suggests S.random_element().parent() is S as a doctest, but I don't think that will work here:

sage: S = FiniteEnumeratedSet([1,2,3])                                                   
sage: a = S.random_element()                                                             
sage: a                                                                                  
2
sage: a.parent()                                                                         
Integer Ring
sage: S.random_element().parent() is S                                                   
False
kliem commented
comment:6

Thank you. I think it is fine.

kliem commented

Reviewer: Jonathan Kliem

comment:7

I think it is important to implement fuzzing of the doctests, so I will try to look at some of the other tickets in #29935 too. Thanks very much for your extensive work on this project!! (and thank you for the review of this ticket)

kliem commented
comment:8

Thanks.

Well there is #29954, which is pretty annoying and made me slow down a bit. This needs to be taken care of.

Changed branch from public/29973 to aae7813