Skip to content
This repository was archived by the owner on Feb 1, 2023. It is now read-only.

Commit 12ecb78

Browse files
author
Jonathan Kliem
committed
added doctests
1 parent 42ac714 commit 12ecb78

File tree

1 file changed

+25
-1
lines changed
  • src/sage/geometry/polyhedron

1 file changed

+25
-1
lines changed

src/sage/geometry/polyhedron/base.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,30 @@ def __init__(self, parent, Vrep, Hrep, Vrep_minimal=None, Hrep_minimal=None, pre
137137
Traceback (most recent call last):
138138
...
139139
ValueError: if both Vrep and Hrep are provided, they must be minimal...
140+
141+
Illustration of ``pref_rep``.
142+
Note that ``ppl`` doesn't support precomputed data::
143+
144+
sage: from sage.geometry.polyhedron.backend_ppl import Polyhedron_QQ_ppl
145+
sage: from sage.geometry.polyhedron.parent import Polyhedra_QQ_ppl
146+
sage: parent = Polyhedra_QQ_ppl(QQ, 1, 'ppl')
147+
sage: p = Polyhedron_QQ_ppl(parent, Vrep, 'nonsense',
148+
....: Vrep_minimal=True, Hrep_minimal=True, pref_rep='Vrep')
149+
sage: p = Polyhedron_QQ_ppl(parent, 'nonsense', Hrep,
150+
....: Vrep_minimal=True, Hrep_minimal=True, pref_rep='Hrep')
151+
sage: p = Polyhedron_QQ_ppl(parent, 'nonsense', Hrep,
152+
....: Vrep_minimal=True, Hrep_minimal=True, pref_rep='Vrepresentation')
153+
Traceback (most recent call last):
154+
...
155+
ValueError: ``pref_rep`` must be one of ``(None, 'Vrep', 'Hrep')``
156+
157+
If the backend supports precomputed data, ``pref_rep`` is ignored::
158+
159+
sage: p = Polyhedron_field(parent, Vrep, 'nonsense',
160+
....: Vrep_minimal=True, Hrep_minimal=True, pref_rep='Vrep')
161+
Traceback (most recent call last):
162+
...
163+
TypeError: _init_Hrepresentation() takes 3 positional arguments but 9 were given
140164
"""
141165
Element.__init__(self, parent=parent)
142166
if Vrep is not None and Hrep is not None:
@@ -160,7 +184,7 @@ def __init__(self, parent, Vrep, Hrep, Vrep_minimal=None, Hrep_minimal=None, pre
160184
elif pref_rep == 'Hrep':
161185
Vrep = None
162186
else:
163-
ValueError("``pref_rep`` must be one of ``(None, 'Vrep', 'Hrep')``")
187+
raise ValueError("``pref_rep`` must be one of ``(None, 'Vrep', 'Hrep')``")
164188
if Vrep is not None:
165189
vertices, rays, lines = Vrep
166190
if vertices or rays or lines:

0 commit comments

Comments
 (0)