Skip to content

Commit

Permalink
Merge pull request #400 from pyt-team/frantzen/test-python-3.13
Browse files Browse the repository at this point in the history
Test against Python 3.13
  • Loading branch information
ffl096 authored Nov 18, 2024
2 parents 6c06d57 + 61bff0e commit 45304eb
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ concurrency:
cancel-in-progress: true

jobs:
build:
pytest:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12", "3.13"]
flavor: ["dev", "all"]

steps:
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ all = [
"TopoNetX[doc, dev]",

# optional packages that are not required to run the library
"gudhi",
"hypernetx < 2.0.0",
"spharapy"
]
Expand Down
35 changes: 25 additions & 10 deletions test/classes/test_simplicial_complex.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Test simplicial complex class."""

from unittest.mock import Mock

import networkx as nx
import numpy as np
import pytest
Expand All @@ -10,11 +12,6 @@
from toponetx.classes.simplicial_complex import SimplicialComplex
from toponetx.datasets.mesh import stanford_bunny

try:
from gudhi import SimplexTree
except ImportError:
SimplexTree = None

try:
import hypernetx as hnx
except ImportError:
Expand Down Expand Up @@ -819,13 +816,31 @@ def test_to_combinatorial_complex(self):
assert len(result.cells) == len(expected_result.cells)
assert len(result.nodes) == len(expected_result.nodes)

@pytest.mark.skipif(
SimplexTree is None, reason="Optional dependency 'gudhi' not installed."
)
def test_from_gudhi(self):
"""Create a SimplicialComplex from a Gudhi SimplexTree and compare the number of simplices."""
tree = SimplexTree()
tree.insert([1, 2, 3, 5])
gudhi_simplices = [
([1, 2, 3, 5], 0.0),
([1, 2, 3], 0.0),
([1, 2, 5], 0.0),
([1, 2], 0.0),
([1, 3, 5], 0.0),
([1, 3], 0.0),
([1, 5], 0.0),
([1], 0.0),
([2, 3, 5], 0.0),
([2, 3], 0.0),
([2, 5], 0.0),
([2], 0.0),
([3, 5], 0.0),
([3], 0.0),
([5], 0.0),
]
tree = Mock(["get_skeleton", "dimension"])
tree.get_skeleton.side_effect = lambda i: (
s for s in gudhi_simplices if len(s[0]) <= i + 1
)
tree.dimension.return_value = 3

expected_result = SimplicialComplex()
expected_result.add_simplex((1, 2, 3, 5))
result = SimplicialComplex.from_gudhi(tree)
Expand Down

0 comments on commit 45304eb

Please # to comment.