Opened 14 months ago

Last modified 9 days ago

#32294 new defect

Fix failing doctests in groups/perm_gps/permgroup.py

Reported by: Samuel Lelièvre Owned by:
Priority: major Milestone: sage-9.8
Component: packages: experimental Keywords: permgroup
Cc: Emmanuel Charpentier, Samuel Lelièvre Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by Samuel Lelièvre)

Part of #25536.

In Sage 9.4.rc1, the output for some examples varies depending on not-sure-what.

Some tests in src/sage/groups/perm_gps/permgroup.py can fail as follows:

$ sage -t --long src/sage/groups/perm_gps/permgroup.py
Running doctests with ID 2021-07-28-23-47-16-14f5337b.
Git branch: develop
Using --optional=...
Doctesting 1 file.
sage -t --long --random-seed=0 src/sage/groups/perm_gps/permgroup.py
**********************************************************************
File "src/sage/groups/perm_gps/permgroup.py", line 877, in sage.groups.perm_gps.permgroup.PermutationGroup_generic._coerce_map_from_
Failed example:
    p = f(mg); p
Expected:
    (2,33,32,23,31,55)(3,49,38,44,40,28)(4,17,59,62,58,46)(5,21,47,20,43,8)(6,53,50)(7,37,12,57,14,29)(9,41,56,34,64,10)(11,25,19)(13,61,26,51,22,15)(16,45,36)(18,27,35,48,52,54)(24,63,42)(30,39,60)
Got:
    (1,2,6,19,35,33)(3,9,26,14,31,23)(4,13,5)(7,22,17)(8,24,12)(10,16,32,27,20,28)(11,30,18)(15,25,36,34,29,21)
**********************************************************************
File "src/sage/groups/perm_gps/permgroup.py", line 926, in sage.groups.perm_gps.permgroup.PermutationGroup_generic._coerce_map_from_
Failed example:
    P(g1*g2)
Expected:
    (1,3,7,12)(2,4,8,10)(5,11)(6,9)
Got:
    (1,9,7,6)(2,10)(3,11)(4,5,8,12)
**********************************************************************
File "src/sage/groups/perm_gps/permgroup.py", line 928, in sage.groups.perm_gps.permgroup.PermutationGroup_generic._coerce_map_from_
Failed example:
    P1(g1*g2)
Expected:
    (2,29,25,68)(3,57,13,54)(4,11,72,37)(5,39,60,23)(6,64,75,63)(7,21,50,73)(8,46,38,32)(9,74,35,18)(10,44,49,48)(12,16,34,71)(14,79,27,40)(15,26)(17,62,59,76)(19,78,70,65)(20,22,58,51)(24,33,36,43)(28,81,80,52)(30,53,56,69)(31,61)(41,42,67,55)(45,77)(47,66)
Got:
    (1,4,13,11)(2,5,14,18)(3,15,8,16)(6,7)(9,20,19,12)(10,17)
**********************************************************************
1 item had failures:
   3 of  36 in sage.groups.perm_gps.permgroup.PermutationGroup_generic._coerce_map_from_
    [939 tests, 3 failures, 11.74 s]
----------------------------------------------------------------------
sage -t --long --random-seed=0 src/sage/groups/perm_gps/permgroup.py  # 3 doctests failed
----------------------------------------------------------------------
Total time for all tests: 12.0 seconds
    cpu time: 9.5 seconds
    cumulative wall time: 11.7 seconds
Pytest is not installed, skip checking tests that rely on it.

Change History (11)

comment:1 Changed 14 months ago by Samuel Lelièvre

Description: modified (diff)

comment:2 Changed 14 months ago by Samuel Lelièvre

Cc: Emmanuel Charpentier added
Description: modified (diff)
Keywords: optional gap_packages removed
Summary: Fix failing doctests with optional package gap_packagesFix failing doctests in groups/perm_gps/permgroup.py

It would be nice to know if this depends

  • on the processor type
  • on the operating system
  • on some system package being used
  • on some optional package being installed
  • ...

So far I have observed this on Debian 10 "buster" with many optional packages installed.

Can this happen with no optional packages installed?

comment:3 Changed 13 months ago by Dima Pasechnik

GAP has reimplementations of its various methods for group homomorphisms in gap_packages.

I presume one gets unequal, albeit equivalent, homomorphisms, here.

Last edited 13 months ago by Dima Pasechnik (previous) (diff)

comment:4 in reply to:  2 Changed 13 months ago by Emmanuel Charpentier

Replying to slelievre:

It would be nice to know if this depends

  • on the processor type
  • on the operating system
  • on some system package being used
  • on some optional package being installed
  • ...

So far I have observed this on Debian 10 "buster" with many optional packages installed.

Can this happen with no optional packages installed?

FWIW, the system where I observed (repeatedly) ths problem has the following packages installed :

charpent@zen-book-flip:~$ sage -optional | grep -v ot_instal | grep -v package |cut -d "." -f 1 | xargs echo

/usr/local/sage-9/local/lib/python3.9/site-packages/sage/misc/package.py:115: UserWarning?: failed to fetch the version of pkg='ore_algebra' at https://pypi.org/pypi/ore_algebra/json

warnings.warn("failed to fetch the version of pkg={!r} at {}".format(pkg, url))

cmdstanpy cypari2 dot2tex fricas gap_jupyter iniconfig json5 jupyter_kernel_gap jupyter_kernel_singular jupyterlab jupyterlab_server kenzo libsemigroups pandas pycodestyle pyflakes pysingular pytest python_dateutil pyyaml relint saclib sagemath_standard singular_jupyter tqdm ujson

comment:5 in reply to:  3 ; Changed 13 months ago by Emmanuel Charpentier

Replying to dimpase:

GAP has reimplementations of its various methods for group homomorphisms in gap_packages.

I presume one gets unequal, albeit equivalent, homomorphisms, here.

Is there a way to test the equivalence of the result obtained in the doctest to the one expected ? If so, we could do this test in the doctest and search for True or False.

comment:6 Changed 13 months ago by Matthias Köppe

Milestone: sage-9.4sage-9.5

comment:7 Changed 13 months ago by Dima Pasechnik

line 877 test serves no purpose, and can be safely removed (it also depends upon random element generation, I suppose)

Last edited 13 months ago by Dima Pasechnik (previous) (diff)

comment:8 in reply to:  5 Changed 13 months ago by Dima Pasechnik

Replying to charpent:

Replying to dimpase:

GAP has reimplementations of its various methods for group homomorphisms in gap_packages.

I presume one gets unequal, albeit equivalent, homomorphisms, here.

Is there a way to test the equivalence of the result obtained in the doctest to the one expected ? If so, we could do this test in the doctest and search for True or False.

not without changing the code of as_permutation_group(), which does not return the underlying group isomorphism, but only its image.

If one has an underlying isomorphism, one can have a test of the isomorphism property in an invariant way.

Last edited 13 months ago by Dima Pasechnik (previous) (diff)

comment:9 Changed 9 months ago by Matthias Köppe

Milestone: sage-9.5sage-9.6

comment:10 Changed 5 months ago by Matthias Köppe

Milestone: sage-9.6sage-9.7

comment:11 Changed 9 days ago by Matthias Köppe

Milestone: sage-9.7sage-9.8
Note: See TracTickets for help on using tickets.