sagemath/sage

Fix two tests failing at random

Closed this issue · 11 comments

kliem commented

Part of #32544:

sage -t --long --random-seed=321172385432269463934777057410284981568 src/sage/rings/polynomial/multi_polynomial_ring_base.pyx
**********************************************************************
File "src/sage/rings/polynomial/multi_polynomial_ring_base.pyx", line 994, in sage.rings.polynomial.multi_polynomial_ring_base.MPolynomialRing_base.random_element
Failed example:
    len(list(f))
Expected:
    1
Got:
    0
sage -t --long --random-seed=324642231642420052385517156149041216749 src/sage/dynamics/arithmetic_dynamics/projective_ds.py
**********************************************************************
File "src/sage/dynamics/arithmetic_dynamics/projective_ds.py", line 7076, in sage.dynamics.arithmetic_dynamics.projective_ds.?.conjugating_set
Failed example:
    D6.conjugating_set(D6)
Expected:
    [
    [1 0]  [0 1]  [0 2]  [4 0]  [2 0]  [0 4]
    [0 1], [1 0], [1 0], [0 1], [0 1], [1 0]
    ]
Got:
    [
    [4 0]  [2 0]  [0 4]  [1 0]  [0 1]  [0 2]
    [0 1], [0 1], [1 0], [0 1], [1 0], [1 0]
    ]

I can't reproduce the later one with that seed, but I can reproduce it (with a loop until it fails).

CC: @mkoeppe

Component: doctest framework

Author: Jonathan Kliem

Branch: 4b2e8b8

Reviewer: John Cremona, Markus Wageringel

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

kliem commented

Commit: 4b2e8b8

kliem commented

New commits:

4b2e8b8fix two tests failing at random
kliem commented

Branch: public/32817

comment:2

I'm happy with the fix to the second one.

Reviewer: John Cremona, Markus Wageringel

comment:3

This looks good to me, too.

kliem commented
comment:4

Thank you.

Changed branch from public/32817 to 4b2e8b8

slel commented
comment:6

Why does the link in the branch field here
include changes to build/pkgs/configure?

slel commented

Changed commit from 4b2e8b8 to none

kliem commented
comment:7

Good question. The ticket didn't do those changes:

Checking that my develop is clean:

$ git fetch trac develop
From git://trac.sagemath.org/sage
 * branch                  develop    -> FETCH_HEAD
$ git diff develop FETCH_HEAD 

Checking on the branch public/32817:

$ git fetch trac public/32817
From git://trac.sagemath.org/sage
 * branch                  public/32817 -> FETCH_HEAD
jonathan@kliem-ThinkPad-L570:~/Applications/sage$ git log FETCH_HEAD 
commit 4b2e8b832956a4e427779c2727f33eca73c9053f
Author: Jonathan Kliem <jonathan.kliem@fu-berlin.de>
Date:   Wed Nov 3 11:39:47 2021 +0100

    fix two tests failing at random

commit f716a0b366e31bbb546230140489244cfb68390d
Author: Release Manager <release@sagemath.org>
Date:   Fri Oct 29 00:56:37 2021 +0200

    Updated SageMath version to 9.5.beta5

commit c5a87834e7e2939b878a5134cd240e6c712bd573
Merge: 50776daec4 c8499d1a70
Author: Release Manager <release@sagemath.org>
Date:   Tue Oct 26 01:00:51 2021 +0200

    Trac #32758: fix E713 and E714 in schemes
    
    about negative comparison using "is not"
    
    URL: https://trac.sagemath.org/32758
    Reported by: chapoton
    Ticket author(s): Frédéric Chapoton
    Reviewer(s): Jonathan Kliem
...

Comparing to develop:

$ git log develop | grep "Updated SageMath version to 9.5.beta5" -A 10 -B 10
commit fd91cb6a89a9f947b2369cea5d9cf9a71f31dc2c
Author: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
Date:   Sun Oct 24 12:58:43 2021 -0700

    build/bin/sage-dist-helpers (sdh_pip_install): Pass options on to sdh_store_and_pip_install_wheel

commit f716a0b366e31bbb546230140489244cfb68390d
Author: Release Manager <release@sagemath.org>
Date:   Fri Oct 29 00:56:37 2021 +0200

    Updated SageMath version to 9.5.beta5

commit c5a87834e7e2939b878a5134cd240e6c712bd573
Merge: 50776daec4 c8499d1a70
Author: Release Manager <release@sagemath.org>
Date:   Tue Oct 26 01:00:51 2021 +0200

    Trac #32758: fix E713 and E714 in schemes
    
    about negative comparison using "is not"
$ git diff FETCH_HEAD f716a0b366e31bbb546230140489244cfb68390d
diff --git a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py
index 7eacde3bab..d4cb66af78 100644
--- a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py
+++ b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py
@@ -6940,10 +6940,10 @@ class DynamicalSystem_projective_field(DynamicalSystem_projective,
 
             sage: P.<x,y> = ProjectiveSpace(GF(7), 1)
             sage: D6 = DynamicalSystem_projective([y^2, x^2])
-            sage: sorted(D6.conjugating_set(D6))
+            sage: D6.conjugating_set(D6)
             [
-            [0 1]  [0 2]  [0 4]  [1 0]  [2 0]  [4 0]
-            [1 0], [1 0], [1 0], [0 1], [0 1], [0 1]
+            [1 0]  [0 1]  [0 2]  [4 0]  [2 0]  [0 4]
+            [0 1], [1 0], [1 0], [0 1], [0 1], [1 0]
             ]
 
         ::
diff --git a/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx b/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx
index 5b99c540de..4378d95588 100644
--- a/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx
+++ b/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx
@@ -990,7 +990,7 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing):
 
             sage: R = QQ['x,y']
             sage: S = R['t,u']
-            sage: f = S._random_nonzero_element(degree=2, terms=1)
+            sage: f = S.random_element(degree=2, terms=1)
             sage: len(list(f))
             1
             sage: f.degree() <= 2

Same result for 4b2e8b832956a4e427779c2727f33eca73c9053f:

$ git fetch trac 4b2e8b832956a4e427779c2727f33eca73c9053f
From git://trac.sagemath.org/sage
 * branch                  4b2e8b832956a4e427779c2727f33eca73c9053f -> FETCH_HEAD
$ git diff FETCH_HEAD f716a0b366e31bbb546230140489244cfb68390d
diff --git a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py
index 7eacde3bab..d4cb66af78 100644
--- a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py
+++ b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py
@@ -6940,10 +6940,10 @@ class DynamicalSystem_projective_field(DynamicalSystem_projective,
 
             sage: P.<x,y> = ProjectiveSpace(GF(7), 1)
             sage: D6 = DynamicalSystem_projective([y^2, x^2])
-            sage: sorted(D6.conjugating_set(D6))
+            sage: D6.conjugating_set(D6)
             [
-            [0 1]  [0 2]  [0 4]  [1 0]  [2 0]  [4 0]
-            [1 0], [1 0], [1 0], [0 1], [0 1], [0 1]
+            [1 0]  [0 1]  [0 2]  [4 0]  [2 0]  [0 4]
+            [0 1], [1 0], [1 0], [0 1], [0 1], [1 0]
             ]
 
         ::
diff --git a/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx b/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx
index 5b99c540de..4378d95588 100644
--- a/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx
+++ b/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx
@@ -990,7 +990,7 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing):
 
             sage: R = QQ['x,y']
             sage: S = R['t,u']
-            sage: f = S._random_nonzero_element(degree=2, terms=1)
+            sage: f = S.random_element(degree=2, terms=1)
             sage: len(list(f))
             1
             sage: f.degree() <= 2