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

Commit

Permalink
fix doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
fchapoton committed Oct 9, 2022
1 parent 790a684 commit 854064e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
12 changes: 6 additions & 6 deletions src/sage/misc/sageinspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -2144,11 +2144,11 @@ def sage_getsource(obj):
- William Stein
- extensions by Nick Alexander
"""
#First we should check if the object has a _sage_src_
#method. If it does, we just return the output from
#that. This is useful for getting pexpect interface
#elements to behave similar to regular Python objects
#with respect to introspection.
# First we should check if the object has a _sage_src_
# method. If it does, we just return the output from
# that. This is useful for getting pexpect interface
# elements to behave similar to regular Python objects
# with respect to introspection.
try:
return obj._sage_src_()
except (AttributeError, TypeError):
Expand All @@ -2174,7 +2174,7 @@ def _sage_getsourcelines_name_with_dot(obj):
sage: print(sage_getsource(C.parent_class)) #indirect doctest
class ParentMethods:
...
Returns the Lie bracket `[x, y] = x y - y x` of `x` and `y`.
Return the Lie bracket `[x, y] = x y - y x` of `x` and `y`.
...
TESTS:
Expand Down
34 changes: 17 additions & 17 deletions src/sage/modules/free_module_morphism.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def is_FreeModuleMorphism(x):
"""
return isinstance(x, FreeModuleMorphism)


class FreeModuleMorphism(matrix_morphism.MatrixMorphism):
def __init__(self, parent, A, side="left"):
"""
Expand All @@ -80,7 +81,7 @@ def __init__(self, parent, A, side="left"):
<class 'sage.modules.free_module_morphism.FreeModuleMorphism'>
"""
if not free_module_homspace.is_FreeModuleHomspace(parent):
raise TypeError("parent (=%s) must be a free module hom space"%parent)
raise TypeError("parent (=%s) must be a free module hom space" % parent)
if isinstance(A, matrix_morphism.MatrixMorphism):
A = A.matrix()
A = parent._matrix_space(side)(A)
Expand Down Expand Up @@ -162,15 +163,15 @@ def _repr_(self):
The representation displays which side of the vectors the matrix is acting::
sage: V = ZZ^3
sage: h = V.hom([V.1, V.2, V.0]); h
sage: V = ZZ^3
sage: h = V.hom([V.1, V.2, V.0]); h
Free module morphism defined by the matrix
[0 1 0]
[0 0 1]
[1 0 0]
Domain: Ambient free module of rank 3 over the principal ideal domain Integer Ring
Codomain: Ambient free module of rank 3 over the principal ideal domain Integer Ring
sage: h2 = V.hom([V.1, V.2, V.0], side="right"); h2
sage: h2 = V.hom([V.1, V.2, V.0], side="right"); h2
Free module morphism defined as left-multiplication by the matrix
[0 0 1]
[1 0 0]
Expand Down Expand Up @@ -551,18 +552,18 @@ def eigenvectors(self,extend=True):
], 1), (2, [
(0, 1, 0, 17/7)
], 2)]
::
sage: V = QQ^2
sage: m = matrix(2, [1, 1, 0, 1])
sage: V.hom(m, side="right").eigenvectors()
sage: V = QQ^2
sage: m = matrix(2, [1, 1, 0, 1])
sage: V.hom(m, side="right").eigenvectors()
[(1,
[
(1, 0)
],
2)]
sage: V.hom(m).eigenvectors()
sage: V.hom(m).eigenvectors()
[(1,
[
(0, 1)
Expand Down Expand Up @@ -638,16 +639,16 @@ def eigenspaces(self,extend=True):
Basis matrix:
[0 1 0]
[0 0 1])]
::
sage: V = QQ^2; m = matrix(2, [1, 1, 0, 1])
sage: V.hom(m, side="right").eigenspaces()
sage: V = QQ^2; m = matrix(2, [1, 1, 0, 1])
sage: V.hom(m, side="right").eigenspaces()
[(1,
Vector space of degree 2 and dimension 1 over Rational Field
Basis matrix:
[1 0])]
sage: V.hom(m).eigenspaces()
sage: V.hom(m).eigenspaces()
[(1,
Vector space of degree 2 and dimension 1 over Rational Field
Basis matrix:
Expand Down Expand Up @@ -796,7 +797,7 @@ class BaseIsomorphism1D_to_FM(BaseIsomorphism1D):
sage: W, from_W, to_W = R.free_module(R, basis=4)
Traceback (most recent call last):
...
ValueError: Basis element must be a unit
ValueError: basis element must be a unit
"""
def __init__(self, parent, basis=None):
"""
Expand Down Expand Up @@ -852,7 +853,7 @@ class BaseIsomorphism1D_from_FM(BaseIsomorphism1D):
sage: W, from_W, to_W = R.free_module(R, basis=x)
Traceback (most recent call last):
...
ValueError: Basis element must be a unit
ValueError: basis element must be a unit
"""
def __init__(self, parent, basis=None):
"""
Expand All @@ -878,5 +879,4 @@ def _call_(self, x):
"""
if self._basis is None:
return x[0]
else:
return self.codomain()(x[0] / self._basis)
return self.codomain()(x[0] / self._basis)

0 comments on commit 854064e

Please sign in to comment.