From 704ed9f0e7aaf407a23fef6254e44539deaa89d1 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Mon, 11 Nov 2024 21:12:36 -0500 Subject: [PATCH] src/sage/groups/libgap_mixin.py: hide info warning for isomorphism checks GAP emits an "InfoWarning" message when it is checking for isomorphism between two groups that are not known to be finite. This message is only shown once, however, because after it checks for finiteness, it knows. We have to keep this in mind during tests. For example, File "src/sage/groups/finitely_presented_named.py", line 485, in sage.groups.finitely_presented_named.AlternatingPresentation Failed example: A1.is_isomorphic(A2), A1.order() Expected: (True, 1) Got: #I Forcing finiteness test (True, 1) These warnings are "normal" and there's nothing for the user to do. This commit hides them for the duration of the isomorphism check. Fixes https://github.com/sagemath/sage/issues/38889 --- src/sage/groups/libgap_mixin.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/sage/groups/libgap_mixin.py b/src/sage/groups/libgap_mixin.py index 3491c9f9db0..b14b050bd3b 100644 --- a/src/sage/groups/libgap_mixin.py +++ b/src/sage/groups/libgap_mixin.py @@ -946,4 +946,16 @@ def is_isomorphic(self, H): sage: F == G, G == H, F == H (False, False, False) """ - return self.gap().IsomorphismGroups(H.gap()) != libgap.fail + # If GAP doesn't know that the groups are finite, it will + # check. This emits an informational warning, and then + # annotates the groups as being finite (assuming they were) so + # that future isomorphism checks are silent. This can lead to + # apparent non-determinism in the output as statements are + # rearranged. There's nothing the user can do about this + # anyway, and it happens in trivial cases like the alternating + # group on one element, so we prefer to hide the warning. + old_warnlevel = libgap.InfoLevel(libgap.InfoWarning) + libgap.SetInfoLevel(libgap.InfoWarning, 0) + result = self.gap().IsomorphismGroups(H.gap()) != libgap.fail + libgap.SetInfoLevel(libgap.InfoWarning, old_warnlevel) + return result