regina 7.3.1.1__cp38-cp38-macosx_11_0_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of regina might be problematic. Click here for more details.

Files changed (160) hide show
  1. regina/__init__.py +203 -0
  2. regina/engine.cpython-38-darwin.so +0 -0
  3. regina/plainCompleter.py +221 -0
  4. regina/pyCensus/__init__.py +14 -0
  5. regina/pyCensus/christy-knots-links.tdb +0 -0
  6. regina/pyCensus/closed-hyp-census-full.tdb +0 -0
  7. regina/pyCensus/closed-nor-census-11.tdb +0 -0
  8. regina/pyCensus/closed-or-census-11.tdb +0 -0
  9. regina/pyCensus/cusped-hyp-nor-census-9.tdb +0 -0
  10. regina/pyCensus/cusped-hyp-or-census-9.tdb +0 -0
  11. regina/sageRegina/__init__.py +2 -0
  12. regina/sageRegina/config.py +9 -0
  13. regina/sageRegina/test.py +132 -0
  14. regina/sageRegina/testsuite/CMakeLists.txt +60 -0
  15. regina/sageRegina/testsuite/O2_1.rga +15 -0
  16. regina/sageRegina/testsuite/O2_1.tri +28 -0
  17. regina/sageRegina/testsuite/README.txt +20 -0
  18. regina/sageRegina/testsuite/alltypes.out +1551 -0
  19. regina/sageRegina/testsuite/alltypes.test +88 -0
  20. regina/sageRegina/testsuite/angles.out +102 -0
  21. regina/sageRegina/testsuite/angles.test +72 -0
  22. regina/sageRegina/testsuite/basic_callback.out +124 -0
  23. regina/sageRegina/testsuite/basic_sub.out +7 -0
  24. regina/sageRegina/testsuite/bool.out +6 -0
  25. regina/sageRegina/testsuite/bool.test +64 -0
  26. regina/sageRegina/testsuite/bytes.out +17 -0
  27. regina/sageRegina/testsuite/bytes.test +78 -0
  28. regina/sageRegina/testsuite/callbacks.out +515 -0
  29. regina/sageRegina/testsuite/callbacks.test +281 -0
  30. regina/sageRegina/testsuite/census.out +120 -0
  31. regina/sageRegina/testsuite/census.test +157 -0
  32. regina/sageRegina/testsuite/clone.out +18 -0
  33. regina/sageRegina/testsuite/clone.test +101 -0
  34. regina/sageRegina/testsuite/constructors.out +14 -0
  35. regina/sageRegina/testsuite/constructors.test +97 -0
  36. regina/sageRegina/testsuite/cube.orb +87 -0
  37. regina/sageRegina/testsuite/discs.out +3 -0
  38. regina/sageRegina/testsuite/discs.test +40 -0
  39. regina/sageRegina/testsuite/docstrings.filter +19 -0
  40. regina/sageRegina/testsuite/docstrings.out +808 -0
  41. regina/sageRegina/testsuite/docstrings.out.v3 +808 -0
  42. regina/sageRegina/testsuite/docstrings.test +57 -0
  43. regina/sageRegina/testsuite/dodec.orb +309 -0
  44. regina/sageRegina/testsuite/embeddings.out +23 -0
  45. regina/sageRegina/testsuite/embeddings.test +89 -0
  46. regina/sageRegina/testsuite/enumerate.out +62 -0
  47. regina/sageRegina/testsuite/enumerate.test +82 -0
  48. regina/sageRegina/testsuite/equality.out +112 -0
  49. regina/sageRegina/testsuite/equality.test +310 -0
  50. regina/sageRegina/testsuite/euler.out +15 -0
  51. regina/sageRegina/testsuite/euler.test +95 -0
  52. regina/sageRegina/testsuite/exception.out +7 -0
  53. regina/sageRegina/testsuite/exception.test +100 -0
  54. regina/sageRegina/testsuite/facenumbering.out +546 -0
  55. regina/sageRegina/testsuite/facenumbering.test +74 -0
  56. regina/sageRegina/testsuite/faces.out +40 -0
  57. regina/sageRegina/testsuite/faces.test +72 -0
  58. regina/sageRegina/testsuite/file.out +1229 -0
  59. regina/sageRegina/testsuite/file.test +70 -0
  60. regina/sageRegina/testsuite/file1.rga +0 -0
  61. regina/sageRegina/testsuite/file2.rga +0 -0
  62. regina/sageRegina/testsuite/file3.rga +119 -0
  63. regina/sageRegina/testsuite/flype.out +37 -0
  64. regina/sageRegina/testsuite/flype.test +50 -0
  65. regina/sageRegina/testsuite/generic.out +116 -0
  66. regina/sageRegina/testsuite/generic.test +76 -0
  67. regina/sageRegina/testsuite/groups.out +70 -0
  68. regina/sageRegina/testsuite/groups.test +117 -0
  69. regina/sageRegina/testsuite/hypersurfaces.out +681 -0
  70. regina/sageRegina/testsuite/hypersurfaces.test +90 -0
  71. regina/sageRegina/testsuite/i18n-latin1.rga +8 -0
  72. regina/sageRegina/testsuite/i18n-utf8.rga +8 -0
  73. regina/sageRegina/testsuite/i18n.out +6 -0
  74. regina/sageRegina/testsuite/i18n.test +91 -0
  75. regina/sageRegina/testsuite/id.out +2 -0
  76. regina/sageRegina/testsuite/id.test +47 -0
  77. regina/sageRegina/testsuite/index.out +2 -0
  78. regina/sageRegina/testsuite/index.test +43 -0
  79. regina/sageRegina/testsuite/integer.out +74 -0
  80. regina/sageRegina/testsuite/integer.test +56 -0
  81. regina/sageRegina/testsuite/italian.orb +90 -0
  82. regina/sageRegina/testsuite/iterators.out +118 -0
  83. regina/sageRegina/testsuite/iterators.test +128 -0
  84. regina/sageRegina/testsuite/knotted-Y.orb +47 -0
  85. regina/sageRegina/testsuite/listener.out +43 -0
  86. regina/sageRegina/testsuite/listener.test +101 -0
  87. regina/sageRegina/testsuite/listview.out +416 -0
  88. regina/sageRegina/testsuite/listview.test +253 -0
  89. regina/sageRegina/testsuite/lookup.out +13 -0
  90. regina/sageRegina/testsuite/lookup.test +44 -0
  91. regina/sageRegina/testsuite/memory1.out +62 -0
  92. regina/sageRegina/testsuite/memory1.test +154 -0
  93. regina/sageRegina/testsuite/memory2.out +62 -0
  94. regina/sageRegina/testsuite/memory2.test +124 -0
  95. regina/sageRegina/testsuite/memory3.out +92 -0
  96. regina/sageRegina/testsuite/memory3.test +216 -0
  97. regina/sageRegina/testsuite/misc.out +7 -0
  98. regina/sageRegina/testsuite/misc.test +56 -0
  99. regina/sageRegina/testsuite/operators.out +129 -0
  100. regina/sageRegina/testsuite/operators.test +61 -0
  101. regina/sageRegina/testsuite/orb.out +441 -0
  102. regina/sageRegina/testsuite/orb.test +49 -0
  103. regina/sageRegina/testsuite/pdf.out +4 -0
  104. regina/sageRegina/testsuite/pdf.test +49 -0
  105. regina/sageRegina/testsuite/perm.out +55 -0
  106. regina/sageRegina/testsuite/perm.test +96 -0
  107. regina/sageRegina/testsuite/plantri.out +12 -0
  108. regina/sageRegina/testsuite/plantri.test +60 -0
  109. regina/sageRegina/testsuite/presentations.out +11 -0
  110. regina/sageRegina/testsuite/presentations.test +61 -0
  111. regina/sageRegina/testsuite/refs.out +51 -0
  112. regina/sageRegina/testsuite/refs.test +128 -0
  113. regina/sageRegina/testsuite/repr.out +951 -0
  114. regina/sageRegina/testsuite/repr.out.v3 +951 -0
  115. regina/sageRegina/testsuite/repr.test +548 -0
  116. regina/sageRegina/testsuite/safeheldtype_basic.out +17 -0
  117. regina/sageRegina/testsuite/safeheldtype_basic.test +113 -0
  118. regina/sageRegina/testsuite/safeheldtype_packet.out +58 -0
  119. regina/sageRegina/testsuite/safeheldtype_packet.test +181 -0
  120. regina/sageRegina/testsuite/sample.pdf +0 -0
  121. regina/sageRegina/testsuite/sets.out +7 -0
  122. regina/sageRegina/testsuite/sets.test +44 -0
  123. regina/sageRegina/testsuite/skeleton.out +308 -0
  124. regina/sageRegina/testsuite/skeleton.test +54 -0
  125. regina/sageRegina/testsuite/snappea.out +82 -0
  126. regina/sageRegina/testsuite/snappea.test +107 -0
  127. regina/sageRegina/testsuite/snapshot.out +15 -0
  128. regina/sageRegina/testsuite/snapshot.test +78 -0
  129. regina/sageRegina/testsuite/sort.out +57 -0
  130. regina/sageRegina/testsuite/sort.test +53 -0
  131. regina/sageRegina/testsuite/special.out +4 -0
  132. regina/sageRegina/testsuite/special.test +47 -0
  133. regina/sageRegina/testsuite/standardtri.out +12101 -0
  134. regina/sageRegina/testsuite/standardtri.test +455 -0
  135. regina/sageRegina/testsuite/surfaces.out +2133 -0
  136. regina/sageRegina/testsuite/surfaces.test +114 -0
  137. regina/sageRegina/testsuite/swapping.out +25 -0
  138. regina/sageRegina/testsuite/swapping.test +88 -0
  139. regina/sageRegina/testsuite/testall.in +176 -0
  140. regina/sageRegina/testsuite/testbasic.in +279 -0
  141. regina/sageRegina/testsuite/testcallback.in +150 -0
  142. regina/sageRegina/testsuite/testsub.in +150 -0
  143. regina/sageRegina/testsuite/theta_in_solid_torus.orb +65 -0
  144. regina/sageRegina/testsuite/tightencode.out +40 -0
  145. regina/sageRegina/testsuite/tightencode.test +108 -0
  146. regina/sageRegina/testsuite/treedecomp.out +135 -0
  147. regina/sageRegina/testsuite/treedecomp.test +66 -0
  148. regina/sageRegina/testsuite/treetraversal.out +52 -0
  149. regina/sageRegina/testsuite/treetraversal.test +190 -0
  150. regina/sageRegina/testsuite/trigeneral.out +1251 -0
  151. regina/sageRegina/testsuite/trigeneral.test +155 -0
  152. regina/sageRegina/testsuite/utf8.out +42 -0
  153. regina/sageRegina/testsuite/utf8.test +94 -0
  154. regina/sageRegina/version.py +5 -0
  155. regina/sageSetup.py +41 -0
  156. regina/test.py +6 -0
  157. regina-7.3.1.1.dist-info/METADATA +99 -0
  158. regina-7.3.1.1.dist-info/RECORD +160 -0
  159. regina-7.3.1.1.dist-info/WHEEL +5 -0
  160. regina-7.3.1.1.dist-info/top_level.txt +4 -0
@@ -0,0 +1,114 @@
1
+ # Regina - A Normal Surface Theory Calculator
2
+ # Python Test Suite Component
3
+ #
4
+ # Copyright (c) 2007-2023, Ben Burton
5
+ # For further details contact Ben Burton (bab@debian.org).
6
+ #
7
+ # Provides various tests for normal surface enumeration.
8
+ #
9
+ # This file is a single component of Regina's python test suite. To run
10
+ # the python test suite, move to the main python directory in the source
11
+ # tree and run "make check".
12
+ #
13
+ # This program is free software; you can redistribute it and/or
14
+ # modify it under the terms of the GNU General Public License as
15
+ # published by the Free Software Foundation; either version 2 of the
16
+ # License, or (at your option) any later version.
17
+ #
18
+ # As an exception, when this program is distributed through (i) the
19
+ # App Store by Apple Inc.; (ii) the Mac App Store by Apple Inc.; or
20
+ # (iii) Google Play by Google Inc., then that store may impose any
21
+ # digital rights management, device limits and/or redistribution
22
+ # restrictions that are required by its terms of service.
23
+ #
24
+ # This program is distributed in the hope that it will be useful, but
25
+ # WITHOUT ANY WARRANTY; without even the implied warranty of
26
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27
+ # General Public License for more details.
28
+ #
29
+ # You should have received a copy of the GNU General Public
30
+ # License along with this program; if not, write to the Free
31
+ # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
32
+ # MA 02110-1301, USA.
33
+
34
+ def dumpSurfaces(name, tri, triName, coords = regina.NS_STANDARD, which = regina.NS_LIST_DEFAULT):
35
+ try:
36
+ slist = regina.NormalSurfaces(tri, coords, which)
37
+ except:
38
+ print("-------------------------------")
39
+ print(name)
40
+ print('ENUMERATION FAILED')
41
+ print("-------------------------------")
42
+ print()
43
+ return
44
+
45
+ print("-------------------------------")
46
+ print(triName)
47
+ print(name)
48
+ print("-------------------------------")
49
+ print()
50
+
51
+ # Dump the surfaces in sort order, since we don't really mind if the
52
+ # ordering changes between releases.
53
+ surfaces = slist.detail().split('\n')
54
+ surfaces.sort()
55
+ # Let the text headers appear up top.
56
+ surfaces.reverse()
57
+ for s in surfaces:
58
+ print(s)
59
+
60
+ # Nothing else to say.
61
+ print()
62
+
63
+ def surfaceStats(tri, triName):
64
+ dumpSurfaces('Vertex surfaces (std)',
65
+ tri, triName, regina.NS_STANDARD)
66
+ dumpSurfaces('Vertex surfaces (quad)',
67
+ tri, triName, regina.NS_QUAD)
68
+ dumpSurfaces('Vertex surfaces (std almost normal)',
69
+ tri, triName, regina.NS_AN_STANDARD)
70
+ dumpSurfaces('Vertex surfaces (quad-oct almost normal)',
71
+ tri, triName, regina.NS_AN_QUAD_OCT)
72
+ dumpSurfaces('Vertex surfaces (closed quad)',
73
+ tri, triName, regina.NS_QUAD_CLOSED)
74
+ dumpSurfaces('Vertex surfaces (closed quad-oct)',
75
+ tri, triName, regina.NS_AN_QUAD_OCT_CLOSED)
76
+ dumpSurfaces('Fundamental surfaces (std)',
77
+ tri, triName, regina.NS_STANDARD, regina.NS_FUNDAMENTAL)
78
+ dumpSurfaces('Fundamental surfaces (quad)',
79
+ tri, triName, regina.NS_QUAD, regina.NS_FUNDAMENTAL)
80
+ dumpSurfaces('Fundamental surfaces (std almost normal)',
81
+ tri, triName, regina.NS_AN_STANDARD, regina.NS_FUNDAMENTAL)
82
+ dumpSurfaces('Fundamental surfaces (quad-oct almost normal)',
83
+ tri, triName, regina.NS_AN_QUAD_OCT, regina.NS_FUNDAMENTAL)
84
+ dumpSurfaces('Fundamental surfaces (closed quad)',
85
+ tri, triName, regina.NS_QUAD_CLOSED, regina.NS_FUNDAMENTAL)
86
+ dumpSurfaces('Fundamental surfaces (closed quad-oct)',
87
+ tri, triName, regina.NS_AN_QUAD_OCT_CLOSED, regina.NS_FUNDAMENTAL)
88
+
89
+ # Start with the tables of constants for disc types.
90
+ print(quadSeparating)
91
+ print(quadMeeting)
92
+ print(quadDefn)
93
+ print(quadPartner)
94
+ print(quadString)
95
+ print(triDiscArcs)
96
+ print(quadDiscArcs)
97
+ print(octDiscArcs)
98
+ print()
99
+
100
+ t = regina.Triangulation3()
101
+ surfaceStats(t, 'Empty triangulation')
102
+
103
+ surfaceStats(regina.Example3.threeSphere(), '3-sphere')
104
+ surfaceStats(regina.Example3.s2xs1(), 'S2 x S1')
105
+ surfaceStats(regina.Example3.rp2xs1(), 'RP2 x S1')
106
+ surfaceStats(regina.Example3.rp3rp3(), 'RP3 # RP3')
107
+ surfaceStats(regina.Example3.lens(8,3), 'L(8,3)')
108
+ surfaceStats(regina.Example3.poincare(), 'Poincare homology sphere')
109
+ surfaceStats(regina.Example3.lst(3,4), 'LST(3,4,7)')
110
+ surfaceStats(regina.Example3.solidKleinBottle(), 'Solid Klein bottle')
111
+ surfaceStats(regina.Example3.figureEight(), 'Figure eight knot complement')
112
+ surfaceStats(regina.Example3.whiteheadLink(), 'Whitehead link complement')
113
+ surfaceStats(regina.Example3.gieseking(), 'Gieseking manifold')
114
+ surfaceStats(regina.Example3.trefoil(), 'Trefoil knot complement')
@@ -0,0 +1,25 @@
1
+ 3 4 | -x^8 + x^6 + x^2 | x^4 - x^2 + 1 - x^-2 + x^-4
2
+ 4 3 | x^4 - x^2 + 1 - x^-2 + x^-4 | -x^8 + x^6 + x^2
3
+ 3 4 | -x^8 + x^6 + x^2 | x^4 - x^2 + 1 - x^-2 + x^-4
4
+
5
+ 2 1 | 0 | Z
6
+ 1 2 | Z | 0
7
+ 2 1 | 0 | Z
8
+
9
+ 23 2 | 3 Z_5 | Z
10
+ 2 23 | Z | 3 Z_5
11
+ 23 2 | 3 Z_5 | Z
12
+
13
+ 1 2 | 2.0299 | 3.6639
14
+ 2 1 | 3.6639 | 2.0299
15
+ 1 2 | 2.0299 | 3.6639
16
+
17
+ 2 4 False
18
+ 0 2 True
19
+
20
+ 2 4 False
21
+ 0 2 True
22
+
23
+ 2 4 False
24
+ 0 2 True
25
+
@@ -0,0 +1,88 @@
1
+ # Regina - A Normal Surface Theory Calculator
2
+ # Python Test Suite Component
3
+ #
4
+ # Copyright (c) 2007-2023, Ben Burton
5
+ # For further details contact Ben Burton (bab@debian.org).
6
+ #
7
+ # Provides detailed tests for C++ Swappable types.
8
+ #
9
+ # This file is a single component of Regina's python test suite. To run
10
+ # the python test suite, move to the main python directory in the source
11
+ # tree and run "make check".
12
+ #
13
+ # This program is free software; you can redistribute it and/or
14
+ # modify it under the terms of the GNU General Public License as
15
+ # published by the Free Software Foundation; either version 2 of the
16
+ # License, or (at your option) any later version.
17
+ #
18
+ # As an exception, when this program is distributed through (i) the
19
+ # App Store by Apple Inc.; (ii) the Mac App Store by Apple Inc.; or
20
+ # (iii) Google Play by Google Inc., then that store may impose any
21
+ # digital rights management, device limits and/or redistribution
22
+ # restrictions that are required by its terms of service.
23
+ #
24
+ # This program is distributed in the hope that it will be useful, but
25
+ # WITHOUT ANY WARRANTY; without even the implied warranty of
26
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27
+ # General Public License for more details.
28
+ #
29
+ # You should have received a copy of the GNU General Public
30
+ # License along with this program; if not, write to the Free
31
+ # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
32
+ # MA 02110-1301, USA.
33
+
34
+ a = ExampleLink.trefoil(); b = ExampleLink.figureEight()
35
+ print(a.size(), b.size(), '|', a.jones(), '|', b.jones())
36
+ swap(a, b)
37
+ print(a.size(), b.size(), '|', a.jones(), '|', b.jones())
38
+ a.swap(b)
39
+ print(a.size(), b.size(), '|', a.jones(), '|', b.jones())
40
+ print()
41
+
42
+ a = Example5.sphere(); b = Example5.ballBundle()
43
+ print(a.size(), b.size(), '|', a.homology(), '|', b.homology())
44
+ swap(a, b)
45
+ print(a.size(), b.size(), '|', a.homology(), '|', b.homology())
46
+ a.swap(b)
47
+ print(a.size(), b.size(), '|', a.homology(), '|', b.homology())
48
+ print()
49
+
50
+ a = Example3.weberSeifert(); b = Example3.figureEight()
51
+ print(a.size(), b.size(), '|', a.homology(), '|', b.homology())
52
+ swap(a, b)
53
+ print(a.size(), b.size(), '|', a.homology(), '|', b.homology())
54
+ a.swap(b)
55
+ print(a.size(), b.size(), '|', a.homology(), '|', b.homology())
56
+ print()
57
+
58
+ a = ExampleSnapPea.figureEight(); b = ExampleSnapPea.whiteheadLink()
59
+ print(a.countCusps(), b.countCusps(), '|', '%.4f'%a.volume(), '|', '%.4f'%b.volume())
60
+ swap(a, b)
61
+ print(a.countCusps(), b.countCusps(), '|', '%.4f'%a.volume(), '|', '%.4f'%b.volume())
62
+ a.swap(b)
63
+ print(a.countCusps(), b.countCusps(), '|', '%.4f'%a.volume(), '|', '%.4f'%b.volume())
64
+ print()
65
+
66
+ # The following examples should all nullify the SnapPea triangulation,
67
+ # since they will fall back to the Triangulation<3> swap function.
68
+
69
+ a = ExampleSnapPea.figureEight(); b = Example3.whiteheadLink()
70
+ print(a.size(), b.size(), a.isNull())
71
+ swap(a, b)
72
+ print(a.size(), b.size(), a.isNull())
73
+ print()
74
+
75
+ a = ExampleSnapPea.figureEight(); b = Example3.whiteheadLink()
76
+ print(a.size(), b.size(), a.isNull())
77
+ swap(b, a)
78
+ print(a.size(), b.size(), a.isNull())
79
+ print()
80
+
81
+ a = ExampleSnapPea.figureEight(); b = Example3.whiteheadLink()
82
+ print(a.size(), b.size(), a.isNull())
83
+ # Note: a.swap(b) is not recognised by python, since it seems that
84
+ # SnapPeaTriangulation's swap() member hides Triangulation<3>'s swap() member.
85
+ b.swap(a)
86
+ print(a.size(), b.size(), a.isNull())
87
+ print()
88
+
@@ -0,0 +1,176 @@
1
+ #!/bin/bash
2
+ #
3
+ # Regina - A Normal Surface Theory Calculator
4
+ # Python Test Suite Runner
5
+ #
6
+ # Copyright (c) 2007-2023, Ben Burton
7
+ # For further details contact Ben Burton (bab@debian.org).
8
+ #
9
+ # Usage: testall
10
+ #
11
+ # Runs the entire Python test suite. This script searches for files
12
+ # named *.test in or beneath the current directory, runs them through
13
+ # regina-python, and compares the results byte-by-byte with the
14
+ # corresponding *.out files. Any mismatches are considered to be test
15
+ # failures.
16
+ #
17
+ # If the output is expected to differ between pybind11 2.x.y (used with
18
+ # Python 3.11 and earlier) vs pybind11 3.x.y (used with Python 3.12 and
19
+ # later), there should instead be two output files: *.out.v2 and *.out.v3.
20
+ # If *.out is present, this will take priority over *.out.v2 and/or *.out.v3.
21
+ #
22
+ # This script MUST be run from the python/testsuite directory in the
23
+ # build tree. It runs regina-python directly out of the build tree.
24
+ # It does not require regina to be installed on the system (and indeed
25
+ # it ignores any installation that it might find).
26
+ #
27
+ # Because tests might need to access other files within the source tree
28
+ # (which might not be the same as the build tree), the corresponding
29
+ # python/testsuite directory within the source tree will be passed as an
30
+ # argument to each test script.
31
+ #
32
+ # This program is free software; you can redistribute it and/or
33
+ # modify it under the terms of the GNU General Public License as
34
+ # published by the Free Software Foundation; either version 2 of the
35
+ # License, or (at your option) any later version.
36
+ #
37
+ # As an exception, when this program is distributed through (i) the
38
+ # App Store by Apple Inc.; (ii) the Mac App Store by Apple Inc.; or
39
+ # (iii) Google Play by Google Inc., then that store may impose any
40
+ # digital rights management, device limits and/or redistribution
41
+ # restrictions that are required by its terms of service.
42
+ #
43
+ # This program is distributed in the hope that it will be useful, but
44
+ # WITHOUT ANY WARRANTY; without even the implied warranty of
45
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
46
+ # General Public License for more details.
47
+ #
48
+ # You should have received a copy of the GNU General Public
49
+ # License along with this program; if not, write to the Free
50
+ # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
51
+ # MA 02110-1301, USA.
52
+
53
+ set -e
54
+
55
+ # To see the output, you need to run:
56
+ # make test ARGS="-V"
57
+
58
+ executable=../regina-python
59
+ testdir='@BASH_CMAKE_SOURCE_DIR@/python/testsuite'
60
+ testoutdir=`mktemp -d -t regina.XXX`
61
+ pybind11_version='@REGINA_PYBIND11_VERSION@'
62
+
63
+ echo "---------------------------------------"
64
+ echo "Test suite for Regina's python bindings"
65
+ echo "---------------------------------------"
66
+ echo
67
+
68
+ if ! test -f ../../CMakeCache.txt -a -f "$executable"; then
69
+ echo "ERROR: You do not appear to be within the python/testsuite directory"
70
+ echo " in the build tree. This script must be run from directly"
71
+ echo " within the build tree (where you ran cmake)."
72
+ echo " Please change into the python/testsuite directory in the"
73
+ echo " build tree and try again."
74
+ exit 1
75
+ fi
76
+
77
+ # Clobber environment variables that the user might already have set.
78
+ export REGINA_VERBOSITY=
79
+ export REGINA_PYLIBDIR=
80
+ export REGINA_HOME=
81
+
82
+ broken=
83
+ found=
84
+
85
+ # We need to loop through all files $testdir/*.test .
86
+ # Because $testdir may contain spaces, we use a slightly tortured loop
87
+ # with the source 'find' statement at the end (not the beginning).
88
+ # See http://mywiki.wooledge.org/BashFAQ/020 for details.
89
+ #
90
+ # Note that both "find -print0" and "sort -z" (which are part of our machinery
91
+ # to handle spaces correctly) are implemented in both GNU and BSD utilities.
92
+ #
93
+ while IFS= read -r -d $'\0' i; do
94
+ found=1
95
+ testname=`basename "$i"`
96
+ expected="${i/.test/.out}"
97
+ if [ ! -e "$expected" ]; then
98
+ expected="$expected.v$pybind11_version"
99
+ fi
100
+ observed="$testoutdir/${testname/.test/.out}"
101
+ filter="$testdir/${testname/.test/.filter}"
102
+
103
+ # Run the test.
104
+ #
105
+ # Since we have "set -e", we need "&& dummy=" to prevent this line to just
106
+ # exit the bash script when the test has non-zero exit code.
107
+ # We use && as opposed to || in order to preserve the exit code from
108
+ # the first command.
109
+ #
110
+ # The code that unsets TERM fixes an issue seen some years ago on
111
+ # Fedora, where (as a result of a more exotic TERM setting) unprintable
112
+ # characters were being dumped at the beginning of the python output.
113
+ #
114
+ if [ -e "$filter" ]; then
115
+ echo -n "Running $testname (with filter) ... "
116
+ TERM= PYTHONIOENCODING=utf8 \
117
+ "$executable" "$i" "$testdir" | "$filter" > "$observed" 2>&1 && dummy=
118
+ else
119
+ echo -n "Running $testname ... "
120
+ TERM= PYTHONIOENCODING=utf8 \
121
+ "$executable" "$i" "$testdir" > "$observed" 2>&1 && dummy=
122
+ fi
123
+
124
+ # Catch exitcode.
125
+ exitcode=$?
126
+
127
+ # Branch based on exit code.
128
+ if [ "$exitcode" -ne 0 ]; then
129
+ echo "FAILED (exit code $exitcode)"
130
+ echo " Output was:"
131
+ echo " ..."
132
+ tail -n 5 $observed | sed -e 's/^/ /'
133
+ broken=1
134
+ else
135
+ if ! ( diff --strip-trailing-cr "$expected" "$observed" > /dev/null ); then
136
+ echo "FAILED (output differs from expected)"
137
+ echo " Diff was:"
138
+ diff --strip-trailing-cr -u \
139
+ --label 'Expected output' --label 'Actual output' \
140
+ "$expected" "$observed" | head -n200 | sed -e 's/^/ /'
141
+ echo " ..."
142
+ broken=1
143
+ else
144
+ echo "ok"
145
+ rm -f "$observed"
146
+ fi
147
+ fi
148
+ done < <(find "$testdir" -name "*.test" -print0 | sort -z)
149
+
150
+ if ! test -n "$found"; then
151
+ echo "ERROR: No tests were found!"
152
+ echo
153
+ echo " Please check your installation, and please ensure that"
154
+ echo " you are running this script from within the python/testsuite"
155
+ echo " directory of the build tree."
156
+ echo
157
+ echo " Note that the build tree might not be the same as the source"
158
+ echo " tree. The build tree is where you ran the configure script."
159
+ exit 1
160
+ fi
161
+
162
+ if test -n "$broken"; then
163
+ echo
164
+ echo "One or more tests failed."
165
+ echo "Please see the list above for details."
166
+ echo
167
+ echo "The full output file(s) produced by Regina are in the directory:"
168
+ echo " $testoutdir"
169
+ exit 1
170
+ else
171
+ rmdir "$testoutdir"
172
+ fi
173
+
174
+ echo
175
+ echo "All tests passed!"
176
+ exit 0
@@ -0,0 +1,279 @@
1
+ #!/bin/bash
2
+ #
3
+ # Regina - A Normal Surface Theory Calculator
4
+ # Python Test Suite Runner
5
+ #
6
+ # Copyright (c) 2007-2023, Ben Burton
7
+ # For further details contact Ben Burton (bab@debian.org).
8
+ #
9
+ # Usage: testbasic
10
+ #
11
+ # Runs most but not all of the Python test suite using a basic C++ executable
12
+ # with an embedded Python interpreter and an in-built timeout feature.
13
+ #
14
+ # Like testall, this script works through all *.test files in or beneath
15
+ # the current directory; however, unlike testall it skips those tests
16
+ # whose names are in a hard-coded blacklist. Similar to testall, this
17
+ # script runs each test through the basic embedded Python interpreter and
18
+ # compares the results byte-by-byte with the corresponding *.out files
19
+ # (or, if the output differs between pybind11 versions, *.out.v2 and *.out.v3).
20
+ # Any mismatches or timeouts are considered to be test failures.
21
+ #
22
+ # This script MUST be run from the python/testsuite directory in the
23
+ # build tree. It runs everything directly out of the build tree.
24
+ # It does not require regina to be installed on the system (and indeed
25
+ # it ignores any installation that it might find).
26
+ #
27
+ # Unlike testall, the corresponding python/testsuite directory will *not*
28
+ # be passed to the test scripts. Any scripts that require this information
29
+ # should not be used with testbasic.
30
+ #
31
+ # This program is free software; you can redistribute it and/or
32
+ # modify it under the terms of the GNU General Public License as
33
+ # published by the Free Software Foundation; either version 2 of the
34
+ # License, or (at your option) any later version.
35
+ #
36
+ # As an exception, when this program is distributed through (i) the
37
+ # App Store by Apple Inc.; (ii) the Mac App Store by Apple Inc.; or
38
+ # (iii) Google Play by Google Inc., then that store may impose any
39
+ # digital rights management, device limits and/or redistribution
40
+ # restrictions that are required by its terms of service.
41
+ #
42
+ # This program is distributed in the hope that it will be useful, but
43
+ # WITHOUT ANY WARRANTY; without even the implied warranty of
44
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
45
+ # General Public License for more details.
46
+ #
47
+ # You should have received a copy of the GNU General Public
48
+ # License along with this program; if not, write to the Free
49
+ # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
50
+ # MA 02110-1301, USA.
51
+
52
+ set -e
53
+
54
+ # To see the output, you need to run:
55
+ # make test ARGS="-V"
56
+
57
+ executable=./basic
58
+ testdir='@BASH_CMAKE_SOURCE_DIR@/python/testsuite'
59
+ testoutdir=`mktemp -d -t regina.XXX`
60
+ pybind11_version='@REGINA_PYBIND11_VERSION@'
61
+
62
+ # REGINA_HOME can be deduced from the executable path, but on Windows this
63
+ # deduction gives the wrong style of path (windows vs unix style) for use
64
+ # with the embedded basic Python interpreter. Fix it explicitly here.
65
+ export REGINA_HOME=../../engine
66
+
67
+ # Cases that expect the python/testsuite directory as an argument:
68
+ blacklist="file i18n memory1 orb pdf repr"
69
+
70
+ # The following cases implicitly import the threading module, which leads to a
71
+ # harmless but noisy ignored exception upon shutdown under python 3.12 and
72
+ # above. See: https://github.com/pybind/pybind11/issues/2197
73
+ blacklist="$blacklist docstrings"
74
+
75
+ echo "----------------------------------------------------------------"
76
+ echo "Test suite for python bindings with a basic embedded interpreter"
77
+ echo "----------------------------------------------------------------"
78
+ echo
79
+
80
+ if ! test -f ../../CMakeCache.txt -a -f "$executable"; then
81
+ echo "ERROR: You do not appear to be within the python/testsuite directory"
82
+ echo " in the build tree. This script must be run from directly"
83
+ echo " within the build tree (where you ran cmake)."
84
+ echo " Please change into the python/testsuite directory in the"
85
+ echo " build tree and try again."
86
+ exit 1
87
+ fi
88
+
89
+ # Make sure Python will be able to import regina.
90
+ os='@CMAKE_SYSTEM_NAME@'
91
+ case "$os" in
92
+ Darwin )
93
+ export DYLD_LIBRARY_PATH="../../engine:$DYLD_LIBRARY_PATH"
94
+ export PYTHONPATH="..:$PYTHONPATH"
95
+ ;;
96
+ Windows )
97
+ # The PYTHONHOME directory is incorrectly hard-coded in msys2.
98
+ # Work out the correct value by asking the python interpreter directly.
99
+ PYTHON='@BASH_Python_EXECUTABLE@'
100
+ if [ ! -e "$PYTHON" ]; then
101
+ echo "ERROR: Python interpreter not found: $PYTHON"
102
+ exit 1
103
+ fi
104
+ export PYTHONHOME="`"$PYTHON" -c 'import sys; print(sys.prefix)'`"
105
+ if [ ! -d "$PYTHONHOME" ]; then
106
+ echo "ERROR: Python home not found: $PYTHONHOME"
107
+ exit 1
108
+ fi
109
+
110
+ export PATH="../../engine:$PATH"
111
+ export PYTHONPATH="..;$PYTHONPATH"
112
+ ;;
113
+ * )
114
+ export LD_LIBRARY_PATH="../../engine:$LD_LIBRARY_PATH"
115
+ export PYTHONPATH="..:$PYTHONPATH"
116
+ ;;
117
+ esac
118
+
119
+ # Python 3.10.[0-2] cannot process several of our test scripts due to a
120
+ # breakage in the line-by-line compilation (this was fixed with the
121
+ # introduction of the constant PyCF_ALLOW_INCOMPLETE_INPUT in Python 3.10.3).
122
+ # Note: these *are* still tested with testall (which runs within a normal python
123
+ # interpreter); just not testbasic (which embeds python in a C++ program).
124
+ pyver=`"$executable" -v`
125
+ case "$pyver" in
126
+ 3.10.[0-2]*)
127
+ echo "WARNING: Skipping several tests due to broken line-by-line"
128
+ echo " compilation in embedded python 3.10.[0-2]."
129
+ echo
130
+ blacklist="$blacklist embeddings faces flype groups hypersurfaces"
131
+ blacklist="$blacklist iterators listview presentations refs skeleton"
132
+ blacklist="$blacklist standardtri"
133
+ ;;
134
+ *)
135
+ ;;
136
+ esac
137
+
138
+ found=
139
+ broken=
140
+
141
+ # Decide on a suitable timeout (measured in seconds) for our tests.
142
+ case "$os" in
143
+ Windows )
144
+ # The Windows simulator is *enormously* slow.
145
+ # Give it half an hour (gulp).
146
+ timeout=1800
147
+ ;;
148
+ * )
149
+ # Linux builds may also be running under hardware emulation.
150
+ # Give each test ten minutes, which is *way* more than it should need.
151
+ timeout=600
152
+ ;;
153
+ esac
154
+
155
+ # We need to loop through all files $testdir/*.test .
156
+ # Because $testdir may contain spaces, we use a slightly tortured loop
157
+ # with the source 'find' statement at the end (not the beginning).
158
+ # See http://mywiki.wooledge.org/BashFAQ/020 for details.
159
+ #
160
+ # Note that both "find -print0" and "sort -z" (which are part of our machinery
161
+ # to handle spaces correctly) are implemented in both GNU and BSD utilities.
162
+ #
163
+ while IFS= read -r -d $'\0' i; do
164
+ found=1
165
+ testname=`basename "$i"`
166
+ expected="${i/.test/.out}"
167
+ if [ ! -e "$expected" ]; then
168
+ expected="$expected.v$pybind11_version"
169
+ fi
170
+ observed="$testoutdir/${testname/.test/.out}"
171
+ filter="$testdir/${testname/.test/.filter}"
172
+
173
+ blacklisted=0
174
+ for b in $blacklist; do
175
+ if [ "$testname" = "$b.test" ]; then
176
+ blacklisted=1
177
+ break
178
+ fi
179
+ done
180
+ if [ "$blacklisted" = 1 ]; then
181
+ echo "Skipping $testname"
182
+ continue
183
+ fi
184
+
185
+ # We do not test with a separate execution thread for now, since the
186
+ # current implementation of PythonInterpreter requires code to be executed
187
+ # from the same thread that created the interpreter.
188
+ #
189
+ # for multithreading in 0 1; do
190
+ for multithreading in 0; do
191
+ # Run the test.
192
+ #
193
+ # Since we have "set -e", we need "&& dummy=" to prevent this line to
194
+ # just exit the bash script when the test has non-zero exit code.
195
+ # We use && as opposed to || in order to preserve the exit code from
196
+ # the first command.
197
+ #
198
+ # The code that unsets TERM fixes an issue seen some years ago on
199
+ # Fedora, where (as a result of a more exotic TERM setting) unprintable
200
+ # characters were being dumped at the beginning of the python output.
201
+ #
202
+ if [ -e "$filter" ]; then
203
+ if [ "$multithreading" = 0 ]; then
204
+ # echo -n "Running $testname (with filter, main thread) ... "
205
+ echo -n "Running $testname (with filter) ... "
206
+ TERM= PYTHONIOENCODING=utf8 \
207
+ "$executable" -t "$timeout" "$i" | "$filter" > "$observed" 2>&1 && dummy=
208
+ else
209
+ echo -n "Running $testname (with filter, separate thread) ... "
210
+ TERM= PYTHONIOENCODING=utf8 \
211
+ "$executable" -m -t "$timeout" "$i" | "$filter" > "$observed" 2>&1 && dummy=
212
+ fi
213
+ else
214
+ if [ "$multithreading" = 0 ]; then
215
+ # echo -n "Running $testname (main thread) ... "
216
+ echo -n "Running $testname ... "
217
+ TERM= PYTHONIOENCODING=utf8 \
218
+ "$executable" -t "$timeout" "$i" > "$observed" 2>&1 && dummy=
219
+ else
220
+ echo -n "Running $testname (separate thread) ... "
221
+ TERM= PYTHONIOENCODING=utf8 \
222
+ "$executable" -m -t "$timeout" "$i" > "$observed" 2>&1 && dummy=
223
+ fi
224
+ fi
225
+
226
+ # Catch exitcode.
227
+ exitcode=$?
228
+
229
+ # Branch based on exit code.
230
+ if [ "$exitcode" -ne 0 ]; then
231
+ echo "FAILED (exit code $exitcode)"
232
+ echo " Output was:"
233
+ echo " ..."
234
+ tail -n 5 $observed | sed -e 's/^/ /'
235
+ broken=1
236
+ else
237
+ if ! ( diff --strip-trailing-cr "$expected" "$observed" > /dev/null ); then
238
+ echo "FAILED (output differs from expected)"
239
+ echo " Diff was:"
240
+ diff --strip-trailing-cr -u \
241
+ --label 'Expected output' --label 'Actual output' \
242
+ "$expected" "$observed" | head -n200 | sed -e 's/^/ /'
243
+ echo " ..."
244
+ broken=1
245
+ else
246
+ echo "ok"
247
+ rm -f "$observed"
248
+ fi
249
+ fi
250
+ done
251
+ done < <(find "$testdir" -name "*.test" -print0 | sort -z)
252
+
253
+ if ! test -n "$found"; then
254
+ echo "ERROR: No tests were found!"
255
+ echo
256
+ echo " Please check your installation, and please ensure that"
257
+ echo " you are running this script from within the python/testsuite"
258
+ echo " directory of the build tree."
259
+ echo
260
+ echo " Note that the build tree might not be the same as the source"
261
+ echo " tree. The build tree is where you ran the configure script."
262
+ exit 1
263
+ fi
264
+
265
+ if test -n "$broken"; then
266
+ echo
267
+ echo "One or more tests failed."
268
+ echo "Please see the list above for details."
269
+ echo
270
+ echo "The full output file(s) produced by Regina are in the directory:"
271
+ echo " $testoutdir"
272
+ exit 1
273
+ else
274
+ rmdir "$testoutdir"
275
+ fi
276
+
277
+ echo
278
+ echo "All tests passed!"
279
+ exit 0