Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
A few minor test fixes:
Browse files Browse the repository at this point in the history
* When iterating over GAP records the keys are now returned as GAP
  strings as well (also updated the documentation on this)

* IndexError message from GAP lists does not have a stray period at the
  end (it is spelled the same as an IndexError from a normal Python
  list)

* Minor error due to group iteration order difference
  • Loading branch information
embray committed Feb 16, 2021
1 parent 0ae791e commit 82e7e56
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/sage/algebras/lie_algebras/lie_algebra_element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -328,13 +328,13 @@ cdef class LieAlgebraElementWrapper(ElementWrapper):
sage: parent(u) == L
True
sage: elt = x*y - y*x; elt
b4 - b5
b1 - b5
sage: xp, yp = x.lift_associative(), y.lift_associative()
sage: eltp = xp*yp - yp*xp; eltp
-(1,2) + (1,3)
sage: G = list(S.basis())
sage: G[4] - G[5]
-(1,2) + (1,3)
-(1,2) + (1,3,2)
TESTS::
Expand Down
8 changes: 4 additions & 4 deletions src/sage/libs/gap/element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2258,7 +2258,7 @@ cdef class GapElement_List(GapElement):
sage: lst[10]
Traceback (most recent call last):
...
IndexError: index out of range.
IndexError: index out of range
"""

def __bool__(self):
Expand Down Expand Up @@ -2599,7 +2599,7 @@ cdef class GapElement_Record(GapElement):
We can easily convert a Gap ``rec`` object into a Python ``dict``::
sage: dict(rec)
{'a': 123, 'b': 456}
{"a": 123, "b": 456}
sage: type(_)
<... 'dict'>
Expand Down Expand Up @@ -2642,7 +2642,7 @@ cdef class GapElement_Record(GapElement):
sage: type(iter)
<class 'generator'>
sage: sorted(rec)
[('a', 123), ('b', 456)]
[("a", 123), ("b", 456)]
"""
for k, v in self.obj.__iter__():
# Convert GapObjs to GapElements
Expand Down Expand Up @@ -2692,7 +2692,7 @@ cdef class GapElement_Record(GapElement):
val = val.sage()
except Exception as ex:
val = ex
result[key] = val
result[str(key)] = val
return result


Expand Down
10 changes: 5 additions & 5 deletions src/sage/libs/gap/libgap.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ Or get them as results of computations::
sage: rec['Sym3']
Sym( [ 1 .. 3 ] )
sage: dict(rec)
{'Sym3': Sym( [ 1 .. 3 ] ), 'a': 123, 'b': 456}
{"Sym3": Sym( [ 1 .. 3 ] ), "a": 123, "b": 456}
The output is a Sage dictionary whose keys are Sage strings and whose
Values are instances of :meth:`~sage.libs.gap.element.GapElement`. So,
for example, ``rec['a']`` is not a Sage integer. To recursively
convert the entries into Sage objects, you should use the
The output is a Sage dictionary whose keys are GAP strings and whose Values are
instances of :meth:`~sage.libs.gap.element.GapElement`. So, for example,
``rec['a']`` is not a Sage integer. To recursively convert the keys and entries
into Sage objects, you should use the
:meth:`~sage.libs.gap.element.GapElement.sage` method::
sage: rec.sage()
Expand Down

0 comments on commit 82e7e56

Please sign in to comment.