diff options
author | Marc Glisse <marc.glisse@inria.fr> | 2022-10-16 18:17:36 +0200 |
---|---|---|
committer | Marc Glisse <marc.glisse@inria.fr> | 2022-10-16 18:17:36 +0200 |
commit | b99c9621fb7e1433eb67cc973825e2ee49936571 (patch) | |
tree | 9db6f6f86d3ae549a4f8d7ba5f604d33381a43b3 /src/python/test/test_simplex_tree.py | |
parent | 7b7d71e3a8d1302dc81eb020114fe4c4d767ccb0 (diff) | |
parent | 524718d63a8f633dbcc4fe7db3fe920ebd7e972c (diff) |
Merge branch 'master' into insert
Diffstat (limited to 'src/python/test/test_simplex_tree.py')
-rwxr-xr-x | src/python/test/test_simplex_tree.py | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/python/test/test_simplex_tree.py b/src/python/test/test_simplex_tree.py index 15279c28..59fd889a 100755 --- a/src/python/test/test_simplex_tree.py +++ b/src/python/test/test_simplex_tree.py @@ -8,10 +8,9 @@ - YYYY/MM Author: Description of the modification """ -from gudhi import SimplexTree, __GUDHI_USE_EIGEN3 +from gudhi import SimplexTree import numpy as np import pytest -import numpy as np __author__ = "Vincent Rouvreau" __copyright__ = "Copyright (C) 2016 Inria" @@ -322,6 +321,10 @@ def test_extend_filtration(): ] dgms = st.extended_persistence(min_persistence=-1.0) + assert len(dgms) == 4 + # Sort by (death-birth) descending - we are only interested in those with the longest life span + for idx in range(4): + dgms[idx] = sorted(dgms[idx], key=lambda x: (-abs(x[1][0] - x[1][1]))) assert dgms[0][0][1][0] == pytest.approx(2.0) assert dgms[0][0][1][1] == pytest.approx(3.0) @@ -358,16 +361,11 @@ def test_collapse_edges(): assert st.num_simplices() == 10 - if __GUDHI_USE_EIGEN3: - st.collapse_edges() - assert st.num_simplices() == 9 - assert st.find([1, 3]) == False - for simplex in st.get_skeleton(0): - assert simplex[1] == 1.0 - else: - # If no Eigen3, collapse_edges throws an exception - with pytest.raises(RuntimeError): - st.collapse_edges() + st.collapse_edges() + assert st.num_simplices() == 9 + assert st.find([0, 2]) == False # [1, 3] would be fine as well + for simplex in st.get_skeleton(0): + assert simplex[1] == 1.0 def test_reset_filtration(): @@ -619,7 +617,7 @@ def test_expansion_with_blocker(): def blocker(simplex): try: - # Block all simplices that countains vertex 6 + # Block all simplices that contain vertex 6 simplex.index(6) print(simplex, " is blocked") return True |