Skip to content

Commit

Permalink
[MAINTENANCE] Refactor base class for elements (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
VascoSch92 authored Jun 1, 2024
1 parent 634d977 commit 8083291
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 145 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ FEATURE:

MAINTENANCE:
- `tests`: Refactor. Now the code is more concise, and it is easier to add a new test.
- `symmetria.elements._base.py`: Simplify the base class for elements object.

## \[0.0.4\] - 2024-05-28

Expand Down
11 changes: 11 additions & 0 deletions symmetria/elements/_base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class _Element:
"""Base class for elements."""

@staticmethod
def name() -> str:
"""Shortcut for the class name."""
return __class__.__name__

def rep(self) -> str:
"""Shortcut for `__repr__()`."""
return self.__repr__()
141 changes: 0 additions & 141 deletions symmetria/elements/_interface.py

This file was deleted.

2 changes: 1 addition & 1 deletion symmetria/elements/cycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import symmetria.elements.permutation
import symmetria.elements.cycle_decomposition
from symmetria.elements._interface import _Element
from symmetria.elements._base import _Element

__all__ = ["Cycle"]

Expand Down
2 changes: 1 addition & 1 deletion symmetria/elements/cycle_decomposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import symmetria.elements.cycle
import symmetria.elements.permutation
from symmetria.elements._interface import _Element
from symmetria.elements._base import _Element

__all__ = ["CycleDecomposition"]

Expand Down
2 changes: 1 addition & 1 deletion symmetria/elements/permutation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import symmetria.elements.cycle
import symmetria.elements.cycle_decomposition
from symmetria.elements._interface import _Element
from symmetria.elements._base import _Element

__all__ = ["Permutation"]

Expand Down
2 changes: 1 addition & 1 deletion tests/tests_meta/test_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def test_order(script_methods) -> None:
class TestOrderMethodsElementClass(OrderTestSuite):
"""Test methods order for class `_Element`."""

SCRIPT_PATH = "symmetria/elements/_interface.py"
SCRIPT_PATH = "symmetria/elements/_base.py"


class TestOrderMethodsPermutationClass(OrderTestSuite):
Expand Down

0 comments on commit 8083291

Please sign in to comment.