Skip to content

Commit

Permalink
Merge pull request #380 from pyt-team/frantzen/python-3.12
Browse files Browse the repository at this point in the history
Run tests on Python 3.12
  • Loading branch information
ffl096 committed Jul 6, 2024
2 parents d19d591 + 38400db commit 2a8572f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.10", "3.11"]
python-version: ["3.10", "3.11", "3.12"]
flavor: ["dev", "all"]

steps:
Expand Down
54 changes: 6 additions & 48 deletions test/classes/test_complex.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Test Complex class."""

from abc import ABCMeta

import pytest

from toponetx.classes.complex import Complex
Expand All @@ -12,14 +10,8 @@ class TestComplex:

def test_complex_is_abstract(self):
"""Test if the Complex abstract class is abstract."""
with pytest.raises(TypeError) as exp_exception:
Complex()

assert "Can't instantiate abstract class Complex with abstract methods" in str(
exp_exception.value
)

assert isinstance(Complex, ABCMeta)
with pytest.raises(TypeError):
_ = Complex()

def test_complex_has_abstract_methods(self):
"""Test if the Complex abstract class has all the abstract methods."""
Expand Down Expand Up @@ -48,36 +40,7 @@ def test_complex_inheritance_check(self):
"""Test that the abstract class is forcing implementation in all children classes."""

class ExampleClass(Complex):
"""Create an example class to test Complex Class.
Parameters
----------
name : str
Name of the Complex.
*args
Positional arguments to be passed to the constructor.
**kwargs
Keyword arguments to be passed to the constructor.
"""

def __init__(self, name: str = "", *args, **kwargs) -> None:
"""Initialize the example class.
Parameters
----------
name : str
Name of the Complex.
*args
Positional arguments to be passed to the constructor.
**kwargs
Keyword arguments to be passed to the constructor.
Returns
-------
ExampleClass
The example class is initialized and returned.
"""
super().__init__(name, *args, **kwargs)
"""Create an example class to test Complex Class."""

def clone(self):
"""Test expected behavior from ExampleClass.
Expand All @@ -87,12 +50,7 @@ def clone(self):
NotImplementedError
Currently NotImplementedError is raised.
"""
return NotImplementedError

with pytest.raises(TypeError) as exp_exception:
ExampleClass()
return NotImplementedError()

assert (
"Can't instantiate abstract class ExampleClass with abstract methods"
in str(exp_exception.value)
)
with pytest.raises(TypeError):
_ = ExampleClass()

0 comments on commit 2a8572f

Please sign in to comment.