Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failing doctests in groups/perm_gps/permgroup.py #32294

Open
slel opened this issue Jul 29, 2021 · 9 comments
Open

Fix failing doctests in groups/perm_gps/permgroup.py #32294

slel opened this issue Jul 29, 2021 · 9 comments

Comments

@slel
Copy link
Member

slel commented Jul 29, 2021

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.

CC: @EmmanuelCharpentier @slel

Component: packages: experimental

Keywords: permgroup

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

@slel slel added this to the sage-9.4 milestone Jul 29, 2021
@slel

This comment has been minimized.

@slel
Copy link
Member Author

slel commented Aug 9, 2021

comment:2

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?

@slel

This comment has been minimized.

@slel
Copy link
Member Author

slel commented Aug 9, 2021

Changed keywords from optional, gap_packages, permgroup to permgroup

@slel slel changed the title Fix failing doctests with optional package gap_packages Fix failing doctests in groups/perm_gps/permgroup.py Aug 9, 2021
@dimpase
Copy link
Member

dimpase commented Aug 22, 2021

comment:3

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

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

@EmmanuelCharpentier
Copy link
Mannequin

EmmanuelCharpentier mannequin commented Aug 22, 2021

comment:4

Replying to @slel:

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

@EmmanuelCharpentier
Copy link
Mannequin

EmmanuelCharpentier mannequin commented Aug 22, 2021

comment:5

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.

@mkoeppe mkoeppe modified the milestones: sage-9.4, sage-9.5 Aug 22, 2021
@dimpase
Copy link
Member

dimpase commented Aug 25, 2021

comment:7

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

@dimpase
Copy link
Member

dimpase commented Aug 25, 2021

comment:8

Replying to @EmmanuelCharpentier:

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.

@mkoeppe mkoeppe modified the milestones: sage-9.5, sage-9.6 Dec 18, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.6, sage-9.7 May 3, 2022
@mkoeppe mkoeppe modified the milestones: sage-9.7, sage-9.8 Sep 19, 2022
@mkoeppe mkoeppe removed this from the sage-9.8 milestone Jan 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants