summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Rouvreau <vincent.rouvreau@inria.fr>2022-02-14 11:29:49 +0100
committerVincent Rouvreau <vincent.rouvreau@inria.fr>2022-02-14 11:29:49 +0100
commitc7303733b28d3bc429d4bdfd030409e07430599d (patch)
tree5ecb519459e81355187d2580e549f8b418fde34b
parent1ffe721b41bfa73d87af443b29498f80f4479770 (diff)
Rewrite test as #463 is merged. Rephrase constructor documentation
-rw-r--r--src/python/gudhi/simplex_tree.pyx4
-rwxr-xr-xsrc/python/test/test_simplex_tree.py20
2 files changed, 10 insertions, 14 deletions
diff --git a/src/python/gudhi/simplex_tree.pyx b/src/python/gudhi/simplex_tree.pyx
index 6701d98d..a2b8719a 100644
--- a/src/python/gudhi/simplex_tree.pyx
+++ b/src/python/gudhi/simplex_tree.pyx
@@ -41,9 +41,9 @@ cdef class SimplexTree:
def __init__(self, other = None):
"""SimplexTree constructor.
- :param other: If `other` is a `None` (default value), an empty `SimplexTree` is created.
+ :param other: If `other` is `None` (default value), an empty `SimplexTree` is created.
If `other` is a `SimplexTree`, the `SimplexTree` is constructed from a deep copy of `other`.
- :type other: SimplexTree
+ :type other: SimplexTree (Optional)
:returns: An empty or a copy simplex tree.
:rtype: SimplexTree
diff --git a/src/python/test/test_simplex_tree.py b/src/python/test/test_simplex_tree.py
index 32fc63ec..2c2e09a2 100755
--- a/src/python/test/test_simplex_tree.py
+++ b/src/python/test/test_simplex_tree.py
@@ -463,20 +463,18 @@ def test_equality_operator():
def test_simplex_tree_deep_copy():
st = SimplexTree()
st.insert([1, 2, 3], 0.)
- # persistence is not copied
+ # compute persistence only on the original
st.compute_persistence()
st_copy = st.copy()
- # TODO(VR): when #463 is merged, replace with
- # assert st_copy == st
- assert st_copy.num_vertices() == st.num_vertices()
- assert st_copy.num_simplices() == st.num_simplices()
+ assert st_copy == st
st_filt_list = list(st.get_filtration())
- assert list(st_copy.get_filtration()) == st_filt_list
+ # check persistence is not copied
assert st.__is_persistence_defined() == True
assert st_copy.__is_persistence_defined() == False
+ # remove something in the copy and check the copy is included in the original
st_copy.remove_maximal_simplex([1, 2, 3])
a_filt_list = list(st_copy.get_filtration())
assert len(a_filt_list) < len(st_filt_list)
@@ -491,20 +489,18 @@ def test_simplex_tree_deep_copy():
def test_simplex_tree_deep_copy_constructor():
st = SimplexTree()
st.insert([1, 2, 3], 0.)
- # persistence is not copied
+ # compute persistence only on the original
st.compute_persistence()
st_copy = SimplexTree(st)
- # TODO(VR): when #463 is merged, replace with
- # assert st_copy == st
- assert st_copy.num_vertices() == st.num_vertices()
- assert st_copy.num_simplices() == st.num_simplices()
+ assert st_copy == st
st_filt_list = list(st.get_filtration())
- assert list(st_copy.get_filtration()) == st_filt_list
+ # check persistence is not copied
assert st.__is_persistence_defined() == True
assert st_copy.__is_persistence_defined() == False
+ # remove something in the copy and check the copy is included in the original
st_copy.remove_maximal_simplex([1, 2, 3])
a_filt_list = list(st_copy.get_filtration())
assert len(a_filt_list) < len(st_filt_list)