Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run tests on Python 3.12 #380

Merged
merged 2 commits into from
Jul 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
Loading