Skip to content

Commit a19d2de

Browse files
author
Matthias Koeppe
committed
src/sage/groups/group_exp.py: In doctest, import GroupExpElement explicitly; doctest cosmetics
1 parent 39442e7 commit a19d2de

File tree

1 file changed

+23
-21
lines changed

1 file changed

+23
-21
lines changed

src/sage/groups/group_exp.py

+23-21
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,16 @@
1414
# (at your option) any later version.
1515
# http://www.gnu.org/licenses/
1616
#*****************************************************************************
17+
1718
from sage.categories.commutative_additive_groups import CommutativeAdditiveGroups
18-
from sage.categories.groups import Groups
19-
from sage.structure.element import MultiplicativeGroupElement
20-
from sage.structure.unique_representation import UniqueRepresentation
21-
from sage.structure.parent import Parent
22-
from sage.categories.morphism import SetMorphism
2319
from sage.categories.functor import Functor
20+
from sage.categories.groups import Groups
2421
from sage.categories.homset import Hom
22+
from sage.categories.morphism import SetMorphism
23+
from sage.structure.element import MultiplicativeGroupElement
2524
from sage.structure.element_wrapper import ElementWrapper
25+
from sage.structure.parent import Parent
26+
from sage.structure.unique_representation import UniqueRepresentation
2627

2728

2829
class GroupExp(Functor):
@@ -59,7 +60,7 @@ class GroupExp(Functor):
5960
-3
6061
sage: x.parent()
6162
Multiplicative form of Integer Ring
62-
sage: EZ(-1)*EZ(6) == EZ(5)
63+
sage: EZ(-1) * EZ(6) == EZ(5)
6364
True
6465
sage: EZ(3)^(-1)
6566
-3
@@ -77,9 +78,10 @@ class GroupExp(Functor):
7778
....: return s2.action(mu)
7879
sage: from sage.categories.morphism import SetMorphism
7980
sage: from sage.categories.homset import Hom
80-
sage: f = SetMorphism(Hom(L,L,CommutativeAdditiveGroups()), my_action)
81+
sage: f = SetMorphism(Hom(L, L, CommutativeAdditiveGroups()), my_action)
8182
sage: F = E(f); F
82-
Generic endomorphism of Multiplicative form of Ambient space of the Root system of type ['A', 2]
83+
Generic endomorphism of
84+
Multiplicative form of Ambient space of the Root system of type ['A', 2]
8385
sage: v = L.an_element(); v
8486
(2, 2, 3)
8587
sage: y = F(EL(v)); y
@@ -114,8 +116,8 @@ def _apply_functor(self, x):
114116
OUTPUT: an isomorphic group whose operation is multiplication rather
115117
than addition
116118
117-
In the following example, ``self`` is the functor `GroupExp()`,
118-
`x` is the additive group `QQ^2`, and the output group is stored as `EQ2`.
119+
In the following example, ``self`` is the functor ``GroupExp()``,
120+
``x`` is the additive group ``QQ^2``, and the output group is stored as ``EQ2``.
119121
120122
EXAMPLES::
121123
@@ -145,8 +147,6 @@ def _apply_functor_to_morphism(self, f):
145147
OUTPUT: the above homomorphism, but between the corresponding
146148
multiplicative groups
147149
148-
- The above homomorphism, but between the corresponding multiplicative groups.
149-
150150
In the following example, ``self`` is the functor :class:`GroupExp` and `f`
151151
is an endomorphism of the additive group of integers.
152152
@@ -156,22 +156,23 @@ def _apply_functor_to_morphism(self, f):
156156
....: return x + x
157157
sage: from sage.categories.morphism import SetMorphism
158158
sage: from sage.categories.homset import Hom
159-
sage: f = SetMorphism(Hom(ZZ,ZZ,CommutativeAdditiveGroups()),double)
159+
sage: f = SetMorphism(Hom(ZZ, ZZ, CommutativeAdditiveGroups()), double)
160160
sage: E = GroupExp()
161161
sage: EZ = E._apply_functor(ZZ)
162162
sage: F = E._apply_functor_to_morphism(f)
163163
sage: F.domain() == EZ
164164
True
165165
sage: F.codomain() == EZ
166166
True
167-
sage: F(EZ(3)) == EZ(3)*EZ(3)
167+
sage: F(EZ(3)) == EZ(3) * EZ(3)
168168
True
169169
"""
170170
new_domain = self._apply_functor(f.domain())
171171
new_codomain = self._apply_functor(f.codomain())
172172
new_f = lambda a: new_codomain(f(a.value))
173173
return SetMorphism(Hom(new_domain, new_codomain, Groups()), new_f)
174174

175+
175176
class GroupExpElement(ElementWrapper, MultiplicativeGroupElement):
176177
r"""
177178
An element in the exponential of a commutative additive group.
@@ -184,13 +185,14 @@ class GroupExpElement(ElementWrapper, MultiplicativeGroupElement):
184185
185186
EXAMPLES::
186187
188+
sage: from sage.groups.group_exp import GroupExpElement
187189
sage: G = QQ^2
188190
sage: EG = GroupExp()(G)
189-
sage: z = GroupExpElement(EG, vector(QQ, (1,-3))); z
191+
sage: z = GroupExpElement(EG, vector(QQ, (1, -3))); z
190192
(1, -3)
191193
sage: z.parent()
192194
Multiplicative form of Vector space of dimension 2 over Rational Field
193-
sage: EG(vector(QQ,(1,-3)))==z
195+
sage: EG(vector(QQ, (1, -3))) == z
194196
True
195197
196198
"""
@@ -202,7 +204,7 @@ def __init__(self, parent, x):
202204
sage: EG = GroupExp()(G)
203205
sage: x = EG.an_element(); x
204206
(1, 0)
205-
sage: TestSuite(x).run(skip = "_test_category")
207+
sage: TestSuite(x).run(skip="_test_category")
206208
207209
See the documentation of :meth:`sage.structure.element_wrapper.ElementWrapper.__init__`
208210
for the reason behind skipping the category test.
@@ -233,7 +235,7 @@ def __mul__(self, x):
233235
sage: x = G(2)
234236
sage: x.__mul__(G(3))
235237
5
236-
sage: G.product(G(2),G(3))
238+
sage: G.product(G(2), G(3))
237239
5
238240
"""
239241
return GroupExpElement(self.parent(), self.value + x.value)
@@ -245,7 +247,7 @@ class GroupExp_Class(UniqueRepresentation, Parent):
245247
246248
INPUT:
247249
248-
- `G` -- a commutative additive group
250+
- ``G`` -- a commutative additive group
249251
250252
OUTPUT: the multiplicative form of `G`
251253
@@ -260,7 +262,7 @@ def __init__(self, G):
260262
EXAMPLES::
261263
262264
sage: EG = GroupExp()(QQ^2)
263-
sage: TestSuite(EG).run(skip = "_test_elements")
265+
sage: TestSuite(EG).run(skip="_test_elements")
264266
"""
265267
if G not in CommutativeAdditiveGroups():
266268
raise TypeError("%s must be a commutative additive group" % G)
@@ -286,7 +288,7 @@ def _element_constructor_(self, x):
286288
EXAMPLES::
287289
288290
sage: G = GroupExp()(ZZ)
289-
sage: G(4) # indirect doctest
291+
sage: G(4) # indirect doctest
290292
4
291293
"""
292294
return GroupExpElement(self, x)

0 commit comments

Comments
 (0)