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

Commit

Permalink
ConvexSet_base._test_contains: Test some_elements too
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Jun 17, 2021
1 parent b3ac0f3 commit 7152e1f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/sage/geometry/convex_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# ****************************************************************************

from sage.structure.sage_object import SageObject
from sage.categories.sets_cat import EmptySetError
from sage.misc.abstract_method import abstract_method

class ConvexSet_base(SageObject):
Expand Down Expand Up @@ -587,7 +588,7 @@ def _test_contains(self, tester=None, **options):
space = self.ambient_vector_space()
try:
ambient_point = ambient.an_element()
except (AttributeError, NotImplementedError):
except (AttributeError, NotImplementedError, EmptySetError):
ambient_point = None
space_point = space.an_element()
else:
Expand All @@ -608,6 +609,15 @@ def _test_contains(self, tester=None, **options):
symbolic_space_point = symbolic_space(space_point)
# Only test that it can accept SR vectors without error.
self.contains(symbolic_space_point)
# Test that elements returned by some_elements are contained.
try:
points = self.some_elements()
except NotImplementedError:
pass
else:
for point in points:
tester.assertTrue(self.contains(point))
tester.assertTrue(point in self)

@abstract_method(optional=True)
def intersection(self, other):
Expand Down

0 comments on commit 7152e1f

Please sign in to comment.