Skip to content

Commit

Permalink
sagemathgh-37489: Fix failing docstring in random testing for `quater…
Browse files Browse the repository at this point in the history
…nion_algebra.py`

    
The current code:

```py
sage: set_random_seed(558346185206384723433409773377632267)
sage: q = randrange(1,1000)
....: p = randrange(1,1000)
....: Quat.<i,j,k> = QuaternionAlgebra(-q, -p)
....: O0 = Quat.maximal_order()
....: while True:
....:     b = Quat.random_element()
....:     if gcd(b.reduced_norm(), Quat.discriminant()) == 1:
....:         break
....: O1 = (b * O0).left_order()
....: iso = O0.isomorphism_to(O1); iso
Ring endomorphism of Order of Quaternion Algebra (-667, -662) with base
ring Rational Field with basis (1, 1/2 + 1/2*i, j, 1/2 + 11/58*i + 1/2*j
+ 1/58*k)
  Defn: i |--> i
        j |--> j
        k |--> k
sage: O0
Order of Quaternion Algebra (-667, -662) with base ring Rational Field
with basis (1, 1/2 + 1/2*i, j, 1/2 + 11/58*i + 1/2*j + 1/58*k)
sage: O1
Order of Quaternion Algebra (-667, -662) with base ring Rational Field
with basis (1, 1/2 + 1/2*i, j, 1/2 + 11/58*i + 1/2*j + 1/58*k)
```

Causes a doctest to fail as a `Ring morphism` is expected but when `O0
== O1` then instead a `Ring endomorphism` is computed instead.

We simply truncate the expected output for the random testing from `Ring
morphism` to `Ring ...` fixing the failure.

```
sage -t --random-seed=558346185206384723433409773377632267
src/sage/algebras/quatalg/quaternion_algebra.py
    [562 tests, 17.35 s]
----------------------------------------------------------------------
All tests passed!
----------------------------------------------------------------------
Total time for all tests: 18.7 seconds
    cpu time: 15.6 seconds
    cumulative wall time: 17.3 seconds
```

Fixes sagemath#37488
    
URL: sagemath#37489
Reported by: Giacomo Pope
Reviewer(s): Lorenz Panny
  • Loading branch information
Release Manager committed Mar 29, 2024
2 parents b84c50c + 949d94e commit 1c3f991
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/sage/algebras/quatalg/quaternion_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -2332,7 +2332,7 @@ def isomorphism_to(self, other, *, conjugator=False, B=10):
....: break
sage: O1 = (b * O0).left_order()
sage: iso = O0.isomorphism_to(O1); iso
Ring morphism: ...
Ring ...
sage: iso.domain() == O0
True
sage: iso.codomain() == O1
Expand Down

0 comments on commit 1c3f991

Please sign in to comment.