Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Move test_associativity
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasdiez committed Mar 29, 2022
1 parent 36cfdfc commit fab5793
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
17 changes: 5 additions & 12 deletions src/sage/categories/finite_semigroups_test.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
class TestFiniteSemigroup():
class TestFiniteSemigroup:
"""
Tests for finite semigroups.
"""

@staticmethod
def category_instances():
from sage.categories.examples.finite_semigroups import LeftRegularBand

return [
LeftRegularBand(alphabet = ('a','b')),
LeftRegularBand(alphabet = ('a','b','c')),
LeftRegularBand(alphabet = ('a','b','c', 'd'))
LeftRegularBand(alphabet=("a", "b")),
LeftRegularBand(alphabet=("a", "b", "c")),
LeftRegularBand(alphabet=("a", "b", "c", "d")),
]

def test_associativity(self, set_elements, max_runs):
"""
Test associativity of multiplication of elements.
"""
from sage.misc.misc import some_tuples
for x, y, z in some_tuples(set_elements, 3, max_runs):
assert (x * y) * z == x * (y * z)
13 changes: 13 additions & 0 deletions src/sage/categories/semigroups_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class SemigroupTests:
"""
Generic tests for semigroups.
"""

def test_associativity(self, set_elements, max_runs):
"""
Test associativity of multiplication of elements.
"""
from sage.misc.misc import some_tuples

for x, y, z in some_tuples(set_elements, 3, max_runs):
assert (x * y) * z == x * (y * z)

0 comments on commit fab5793

Please sign in to comment.