diff options
author | Marc Glisse <marc.glisse@inria.fr> | 2020-04-19 13:43:23 +0200 |
---|---|---|
committer | Marc Glisse <marc.glisse@inria.fr> | 2020-04-19 13:43:23 +0200 |
commit | 1fc55e54ed2f24969a691914edee642f97142fa9 (patch) | |
tree | a06b7ae2830779f2d7773af78f6c34213281738c /src/python/test | |
parent | d5c8dc1ba4d00ead5875b97e164d07f6180526b0 (diff) |
Test comparison with persistence_pairs()
Diffstat (limited to 'src/python/test')
-rwxr-xr-x | src/python/test/test_simplex_generators.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/python/test/test_simplex_generators.py b/src/python/test/test_simplex_generators.py index e3bdc094..8a9b4844 100755 --- a/src/python/test/test_simplex_generators.py +++ b/src/python/test/test_simplex_generators.py @@ -24,6 +24,13 @@ def test_flag_generators(): assert np.array_equal(g[2], [0, 4]) assert len(g[3]) == 1 assert np.array_equal(g[3][0], [[7, 6]]) + # Compare trivial cases (where the simplex is the generator) with persistence_pairs. + # This still makes assumptions on the order of vertices in a simplex and could be more robust. + pairs = st.persistence_pairs() + assert {tuple(i) for i in g[0]} == {(i[0][0],) + tuple(i[1]) for i in pairs if len(i[0]) == 1 and len(i[1]) != 0} + assert {(i[0], i[1]) for i in g[1][0]} == {tuple(i[0]) for i in pairs if len(i[0]) == 2 and len(i[1]) != 0} + assert set(g[2]) == {i[0][0] for i in pairs if len(i[0]) == 1 and len(i[1]) == 0} + assert {(i[0], i[1]) for i in g[3][0]} == {tuple(i[0]) for i in pairs if len(i[0]) == 2 and len(i[1]) == 0} def test_lower_star_generators(): |