Skip to content

Commit e22d9e0

Browse files
author
Matthias Koeppe
committed
sage -fixdoctests --distribution sagemath-modules --only-tags --probe all src/sage/{hom,top}ology
1 parent f853201 commit e22d9e0

12 files changed

+135
-110
lines changed

src/sage/homology/homology_group.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def HomologyGroup(n, base_ring, invfac=None):
165165
Multiplicative Abelian group isomorphic to Z x Z x Z x Z
166166
sage: HomologyGroup(4, ZZ)
167167
Z x Z x Z x Z
168-
sage: HomologyGroup(100, ZZ) # needs sage.libs.flint (o/w timeout)
168+
sage: HomologyGroup(100, ZZ)
169169
Z^100
170170
"""
171171
if base_ring.is_field():

src/sage/homology/tests.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# sage.doctest: needs sage.modules
12
"""
23
Tests for chain complexes, simplicial complexes, etc.
34
@@ -9,14 +10,14 @@
910
1011
TESTS::
1112
12-
sage: from sage.homology.tests import test_random_chain_complex # needs sage.modules
13+
sage: from sage.homology.tests import test_random_chain_complex
1314
sage: test_random_chain_complex(trials=20) # optional - CHomP
1415
doctest:...: DeprecationWarning: the CHomP interface is deprecated; hence so is this function
1516
See https://github.com/sagemath/sage/issues/33777 for details.
1617
sage: test_random_chain_complex(level=2, trials=20) # optional - CHomP
1718
sage: test_random_chain_complex(level=3, trials=20) # long time # optional - CHomP
1819
19-
sage: from sage.homology.tests import test_random_simplicial_complex # needs sage.modules
20+
sage: from sage.homology.tests import test_random_simplicial_complex
2021
sage: test_random_simplicial_complex(level=1, trials=20) # optional - CHomP
2122
doctest:...: DeprecationWarning: the CHomP interface is deprecated; hence so is this function
2223
See https://github.com/sagemath/sage/issues/33777 for details.
@@ -46,7 +47,6 @@ def random_chain_complex(level=1):
4647
4748
EXAMPLES::
4849
49-
sage: # needs sage.modules
5050
sage: from sage.homology.tests import random_chain_complex
5151
sage: C = random_chain_complex()
5252
sage: C # random
@@ -85,7 +85,7 @@ def test_random_chain_complex(level=1, trials=1, verbose=False):
8585
8686
EXAMPLES::
8787
88-
sage: from sage.homology.tests import test_random_chain_complex # needs sage.modules
88+
sage: from sage.homology.tests import test_random_chain_complex
8989
sage: test_random_chain_complex(trials=2) # optional - CHomP
9090
doctest:...: DeprecationWarning: the CHomP interface is deprecated; hence so is this function
9191
See https://github.com/sagemath/sage/issues/33777 for details.
@@ -116,11 +116,11 @@ def random_simplicial_complex(level=1, p=0.5):
116116
117117
EXAMPLES::
118118
119-
sage: from sage.homology.tests import random_simplicial_complex # needs sage.modules
120-
sage: X = random_simplicial_complex() # needs sage.modules
121-
sage: X # random # needs sage.modules
119+
sage: from sage.homology.tests import random_simplicial_complex
120+
sage: X = random_simplicial_complex()
121+
sage: X # random
122122
Simplicial complex with vertex set (0, 1, 2, 3, 4, 5, 6, 7) and 31 facets
123-
sage: X.dimension() < 11 # needs sage.modules
123+
sage: X.dimension() < 11
124124
True
125125
"""
126126
n = randint(2, 4 * level)
@@ -147,7 +147,7 @@ def test_random_simplicial_complex(level=1, trials=1, verbose=False):
147147
148148
EXAMPLES::
149149
150-
sage: from sage.homology.tests import test_random_simplicial_complex # needs sage.modules
150+
sage: from sage.homology.tests import test_random_simplicial_complex
151151
sage: test_random_simplicial_complex(trials=2) # optional - CHomP
152152
doctest:...: DeprecationWarning: the CHomP interface is deprecated; hence so is this function
153153
See https://github.com/sagemath/sage/issues/33777 for details.

src/sage/topology/cell_complex.py

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -503,19 +503,20 @@ def homology(self, dim=None, base_ring=ZZ, subcomplex=None,
503503
504504
EXAMPLES::
505505
506+
sage: # needs sage.modules
506507
sage: P = delta_complexes.RealProjectivePlane()
507-
sage: P.homology() # needs sage.modules
508+
sage: P.homology()
508509
{0: 0, 1: C2, 2: 0}
509-
sage: P.homology(reduced=False) # needs sage.modules
510+
sage: P.homology(reduced=False)
510511
{0: Z, 1: C2, 2: 0}
511-
sage: P.homology(base_ring=GF(2)) # needs sage.modules
512+
sage: P.homology(base_ring=GF(2))
512513
{0: Vector space of dimension 0 over Finite Field of size 2,
513514
1: Vector space of dimension 1 over Finite Field of size 2,
514515
2: Vector space of dimension 1 over Finite Field of size 2}
515516
sage: S7 = delta_complexes.Sphere(7)
516-
sage: S7.homology(7) # needs sage.modules
517+
sage: S7.homology(7)
517518
Z
518-
sage: cubical_complexes.KleinBottle().homology(1, base_ring=GF(2)) # needs sage.modules
519+
sage: cubical_complexes.KleinBottle().homology(1, base_ring=GF(2))
519520
Vector space of dimension 2 over Finite Field of size 2
520521
521522
Sage can compute generators of homology groups::
@@ -624,13 +625,14 @@ def cohomology(self, dim=None, base_ring=ZZ, subcomplex=None,
624625
625626
Projective plane::
626627
628+
sage: # needs sage.modules
627629
sage: P2 = SimplicialComplex([[0,1,2], [0,2,3], [0,1,5], [0,4,5], [0,3,4],
628630
....: [1,2,4], [1,3,4], [1,3,5], [2,3,5], [2,4,5]])
629-
sage: P2.cohomology(2) # needs sage.modules
631+
sage: P2.cohomology(2)
630632
C2
631-
sage: P2.cohomology(2, base_ring=GF(2)) # needs sage.modules
633+
sage: P2.cohomology(2, base_ring=GF(2))
632634
Vector space of dimension 1 over Finite Field of size 2
633-
sage: P2.cohomology(2, base_ring=GF(3)) # needs sage.modules
635+
sage: P2.cohomology(2, base_ring=GF(3))
634636
Vector space of dimension 0 over Finite Field of size 3
635637
636638
sage: cubical_complexes.KleinBottle().cohomology(2) # needs sage.modules
@@ -840,16 +842,17 @@ def homology_with_basis(self, base_ring=QQ, cohomology=False):
840842
841843
EXAMPLES::
842844
845+
sage: # needs sage.modules
843846
sage: K = simplicial_complexes.KleinBottle()
844-
sage: H = K.homology_with_basis(QQ); H # needs sage.modules
847+
sage: H = K.homology_with_basis(QQ); H
845848
Homology module of Minimal triangulation of the Klein bottle
846849
over Rational Field
847-
sage: sorted(H.basis(), key=str) # needs sage.modules
850+
sage: sorted(H.basis(), key=str)
848851
[h_{0,0}, h_{1,0}]
849-
sage: H = K.homology_with_basis(GF(2)); H # needs sage.modules
852+
sage: H = K.homology_with_basis(GF(2)); H
850853
Homology module of Minimal triangulation of the Klein bottle
851854
over Finite Field of size 2
852-
sage: sorted(H.basis(), key=str) # needs sage.modules
855+
sage: sorted(H.basis(), key=str)
853856
[h_{0,0}, h_{1,0}, h_{1,1}, h_{2,0}]
854857
855858
The homology is constructed as a graded object, so for
@@ -899,16 +902,17 @@ def cohomology_ring(self, base_ring=QQ):
899902
900903
EXAMPLES::
901904
905+
sage: # needs sage.modules
902906
sage: K = simplicial_complexes.KleinBottle()
903-
sage: H = K.cohomology_ring(QQ); H # needs sage.modules
907+
sage: H = K.cohomology_ring(QQ); H
904908
Cohomology ring of Minimal triangulation of the Klein bottle
905909
over Rational Field
906-
sage: sorted(H.basis(), key=str) # needs sage.modules
910+
sage: sorted(H.basis(), key=str)
907911
[h^{0,0}, h^{1,0}]
908-
sage: H = K.cohomology_ring(GF(2)); H # needs sage.modules
912+
sage: H = K.cohomology_ring(GF(2)); H
909913
Cohomology ring of Minimal triangulation of the Klein bottle
910914
over Finite Field of size 2
911-
sage: sorted(H.basis(), key=str) # needs sage.modules
915+
sage: sorted(H.basis(), key=str)
912916
[h^{0,0}, h^{1,0}, h^{1,1}, h^{2,0}]
913917
914918
sage: X = delta_complexes.SurfaceOfGenus(2)
@@ -944,9 +948,9 @@ def cohomology_ring(self, base_ring=QQ):
944948
sage: RP2 = simplicial_complexes.RealProjectivePlane()
945949
sage: K = RP2.suspension()
946950
sage: K.set_immutable()
947-
sage: y = K.cohomology_ring(GF(2)).basis()[2,0]; y # needs sage.modules sage.rings.finite_rings
951+
sage: y = K.cohomology_ring(GF(2)).basis()[2,0]; y # needs sage.modules
948952
h^{2,0}
949-
sage: y.Sq(1) # needs sage.modules sage.rings.finite_rings
953+
sage: y.Sq(1) # needs sage.modules
950954
h^{3,0}
951955
952956
To compute the cohomology ring, the complex must be

src/sage/topology/cubical_complex.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,28 +1168,30 @@ def chain_complex(self, subcomplex=None, augmented=False,
11681168
11691169
EXAMPLES::
11701170
1171+
sage: # needs sage.modules
11711172
sage: S2 = cubical_complexes.Sphere(2)
1172-
sage: S2.chain_complex() # needs sage.modules
1173+
sage: S2.chain_complex()
11731174
Chain complex with at most 3 nonzero terms over Integer Ring
11741175
sage: Prod = S2.product(S2); Prod
11751176
Cubical complex with 64 vertices and 676 cubes
1176-
sage: Prod.chain_complex() # needs sage.modules
1177+
sage: Prod.chain_complex()
11771178
Chain complex with at most 5 nonzero terms over Integer Ring
1178-
sage: Prod.chain_complex(base_ring=QQ) # needs sage.modules
1179+
sage: Prod.chain_complex(base_ring=QQ)
11791180
Chain complex with at most 5 nonzero terms over Rational Field
11801181
sage: C1 = cubical_complexes.Cube(1)
11811182
sage: S0 = cubical_complexes.Sphere(0)
1182-
sage: C1.chain_complex(subcomplex=S0) # needs sage.modules
1183+
sage: C1.chain_complex(subcomplex=S0)
11831184
Chain complex with at most 1 nonzero terms over Integer Ring
1184-
sage: C1.homology(subcomplex=S0) # needs sage.modules
1185+
sage: C1.homology(subcomplex=S0)
11851186
{0: 0, 1: Z}
11861187
11871188
Check that :trac:`32203` has been fixed::
11881189
1190+
sage: # needs sage.modules
11891191
sage: Square = CubicalComplex([([0,1],[0,1])])
11901192
sage: EdgesLTR = CubicalComplex([([0,0],[0,1]),([0,1],[1,1]),([1,1],[0,1])])
11911193
sage: EdgesLBR = CubicalComplex([([0,0],[0,1]),([0,1],[0,0]),([1,1],[0,1])])
1192-
sage: Square.homology(subcomplex=EdgesLTR)[2] == Square.homology(subcomplex=EdgesLBR)[2] # needs sage.modules
1194+
sage: Square.homology(subcomplex=EdgesLTR)[2] == Square.homology(subcomplex=EdgesLBR)[2]
11931195
True
11941196
"""
11951197
from sage.homology.chain_complex import ChainComplex

src/sage/topology/delta_complex.py

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -605,26 +605,27 @@ def chain_complex(self, subcomplex=None, augmented=False,
605605
606606
EXAMPLES::
607607
608+
sage: # needs sage.modules
608609
sage: circle = delta_complexes.Sphere(1)
609-
sage: circle.chain_complex() # needs sage.modules
610+
sage: circle.chain_complex()
610611
Chain complex with at most 2 nonzero terms over Integer Ring
611-
sage: circle.chain_complex()._latex_() # needs sage.modules
612+
sage: circle.chain_complex()._latex_()
612613
'\\Bold{Z}^{1} \\xrightarrow{d_{1}} \\Bold{Z}^{1}'
613-
sage: circle.chain_complex(base_ring=QQ, augmented=True) # needs sage.modules
614+
sage: circle.chain_complex(base_ring=QQ, augmented=True)
614615
Chain complex with at most 3 nonzero terms over Rational Field
615-
sage: circle.homology(dim=1) # needs sage.modules
616+
sage: circle.homology(dim=1)
616617
Z
617-
sage: circle.cohomology(dim=1) # needs sage.modules
618+
sage: circle.cohomology(dim=1)
618619
Z
619620
sage: T = delta_complexes.Torus()
620-
sage: T.chain_complex(subcomplex=T) # needs sage.modules
621+
sage: T.chain_complex(subcomplex=T)
621622
Trivial chain complex over Integer Ring
622-
sage: T.homology(subcomplex=T) # needs sage.modules
623+
sage: T.homology(subcomplex=T)
623624
{0: 0, 1: 0, 2: 0}
624625
sage: A = T.subcomplex({2: [1]}) # one of the two triangles forming T
625-
sage: T.chain_complex(subcomplex=A) # needs sage.modules
626+
sage: T.chain_complex(subcomplex=A)
626627
Chain complex with at most 1 nonzero terms over Integer Ring
627-
sage: T.homology(subcomplex=A) # needs sage.modules
628+
sage: T.homology(subcomplex=A)
628629
{0: 0, 1: 0, 2: Z}
629630
"""
630631
from sage.homology.chain_complex import ChainComplex
@@ -944,20 +945,23 @@ def product(self, other):
944945
945946
sage: K = delta_complexes.KleinBottle()
946947
sage: X = K.product(K)
947-
sage: X.homology(1) # needs sage.modules
948+
949+
sage: # needs sage.modules
950+
sage: X.homology(1)
948951
Z x Z x C2 x C2
949-
sage: X.homology(2) # needs sage.modules
952+
sage: X.homology(2)
950953
Z x C2 x C2 x C2
951-
sage: X.homology(3) # needs sage.modules
954+
sage: X.homology(3)
952955
C2
953-
sage: X.homology(4) # needs sage.modules
956+
sage: X.homology(4)
954957
0
955-
sage: X.homology(base_ring=GF(2)) # needs sage.modules
958+
sage: X.homology(base_ring=GF(2))
956959
{0: Vector space of dimension 0 over Finite Field of size 2,
957960
1: Vector space of dimension 4 over Finite Field of size 2,
958961
2: Vector space of dimension 6 over Finite Field of size 2,
959962
3: Vector space of dimension 4 over Finite Field of size 2,
960963
4: Vector space of dimension 1 over Finite Field of size 2}
964+
961965
sage: S1 = delta_complexes.Sphere(1)
962966
sage: K.product(S1).homology() == S1.product(K).homology() # needs sage.modules
963967
True
@@ -1144,16 +1148,17 @@ def connected_sum(self, other):
11441148
11451149
EXAMPLES::
11461150
1151+
sage: # needs sage.modules
11471152
sage: T = delta_complexes.Torus()
11481153
sage: S2 = delta_complexes.Sphere(2)
1149-
sage: T.connected_sum(S2).cohomology() == T.cohomology() # needs sage.modules
1154+
sage: T.connected_sum(S2).cohomology() == T.cohomology()
11501155
True
11511156
sage: RP2 = delta_complexes.RealProjectivePlane()
1152-
sage: T.connected_sum(RP2).homology(1) # needs sage.modules
1157+
sage: T.connected_sum(RP2).homology(1)
11531158
Z x Z x C2
1154-
sage: T.connected_sum(RP2).homology(2) # needs sage.modules
1159+
sage: T.connected_sum(RP2).homology(2)
11551160
0
1156-
sage: RP2.connected_sum(RP2).connected_sum(RP2).homology(1) # needs sage.modules
1161+
sage: RP2.connected_sum(RP2).connected_sum(RP2).homology(1)
11571162
Z x Z x C2
11581163
"""
11591164
if not self.dimension() == other.dimension():
@@ -1581,15 +1586,16 @@ def algebraic_topological_model(self, base_ring=None):
15811586
15821587
EXAMPLES::
15831588
1589+
sage: # needs sage.modules
15841590
sage: RP2 = delta_complexes.RealProjectivePlane()
1585-
sage: phi, M = RP2.algebraic_topological_model(GF(2)) # needs sage.modules
1586-
sage: M.homology() # needs sage.modules
1591+
sage: phi, M = RP2.algebraic_topological_model(GF(2))
1592+
sage: M.homology()
15871593
{0: Vector space of dimension 1 over Finite Field of size 2,
15881594
1: Vector space of dimension 1 over Finite Field of size 2,
15891595
2: Vector space of dimension 1 over Finite Field of size 2}
15901596
sage: T = delta_complexes.Torus()
1591-
sage: phi, M = T.algebraic_topological_model(QQ) # needs sage.modules
1592-
sage: M.homology() # needs sage.modules
1597+
sage: phi, M = T.algebraic_topological_model(QQ)
1598+
sage: M.homology()
15931599
{0: Vector space of dimension 1 over Rational Field,
15941600
1: Vector space of dimension 2 over Rational Field,
15951601
2: Vector space of dimension 1 over Rational Field}
@@ -1681,14 +1687,15 @@ def RealProjectivePlane(self):
16811687
16821688
EXAMPLES::
16831689
1690+
sage: # needs sage.modules
16841691
sage: P = delta_complexes.RealProjectivePlane()
1685-
sage: P.cohomology(1) # needs sage.modules
1692+
sage: P.cohomology(1)
16861693
0
1687-
sage: P.cohomology(2) # needs sage.modules
1694+
sage: P.cohomology(2)
16881695
C2
1689-
sage: P.cohomology(dim=1, base_ring=GF(2)) # needs sage.modules
1696+
sage: P.cohomology(dim=1, base_ring=GF(2))
16901697
Vector space of dimension 1 over Finite Field of size 2
1691-
sage: P.cohomology(dim=2, base_ring=GF(2)) # needs sage.modules
1698+
sage: P.cohomology(dim=2, base_ring=GF(2))
16921699
Vector space of dimension 1 over Finite Field of size 2
16931700
"""
16941701
return DeltaComplex((((), ()), ((1, 0), (1, 0), (0, 0)),

0 commit comments

Comments
 (0)