Skip to content
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
11 changes: 3 additions & 8 deletions tests/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
KnuthBendix, etc.
"""

import contextlib
from datetime import timedelta

from libsemigroups_pybind11 import ReportGuard
Expand Down Expand Up @@ -37,13 +36,9 @@ def check_runner(x, t=timedelta(microseconds=1000)): # pylint: disable=missing-
assert not x.stopped_by_predicate()
assert x.timed_out()

# TODO: Why was This was originally:
# try:
# x = x.copy() # copy
# except: # noqa: E722 pylint: disable=bare-except
# pass
with contextlib.suppress(BaseException):
x = x.copy() # copy
assert x is not x.copy()

x = x.copy()

def func():
global N # pylint: disable=global-statement
Expand Down
34 changes: 33 additions & 1 deletion tests/test_presentation_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from libsemigroups_pybind11 import (
POSITIVE_INFINITY,
LibsemigroupsError,
Presentation,
ReportGuard,
ToddCoxeter,
congruence_kind,
Expand Down Expand Up @@ -254,6 +255,8 @@ def test_rectangular_band_ACOR00():
ReportGuard(False)
with pytest.raises(LibsemigroupsError):
examples.rectangular_band_ACOR00(1, 0)

with pytest.raises(LibsemigroupsError):
examples.rectangular_band_ACOR00(0, 1)

p = examples.rectangular_band_ACOR00(4, 5)
Expand All @@ -269,6 +272,8 @@ def test_stellar_monoid_GH19():
ReportGuard(False)
with pytest.raises(LibsemigroupsError):
examples.stellar_monoid_GH19(0)

with pytest.raises(LibsemigroupsError):
examples.stellar_monoid_GH19(1)

# TODO(1) adapt for new Sims API
Expand All @@ -282,6 +287,8 @@ def test_chinese_monoid_CEKNH01():
ReportGuard(False)
with pytest.raises(LibsemigroupsError):
examples.chinese_monoid_CEKNH01(0)

with pytest.raises(LibsemigroupsError):
examples.chinese_monoid_CEKNH01(1)

# TODO(1) adapt for new Sims API
Expand All @@ -296,6 +303,8 @@ def test_monogenic_semigroup():
ReportGuard(False)
with pytest.raises(LibsemigroupsError):
examples.monogenic_semigroup(4, 0)

with pytest.raises(LibsemigroupsError):
examples.monogenic_semigroup(0, 0)

p = examples.monogenic_semigroup(5, 9)
Expand All @@ -307,7 +316,8 @@ def test_plactic_monoid_Knu70():
ReportGuard(False)
with pytest.raises(LibsemigroupsError):
examples.plactic_monoid_Knu70(0)
examples.plactic_monoid_Knu70(1)

assert examples.plactic_monoid_Knu70(1) == Presentation([0])

# TODO(1) adapt for new Sims API
# p = examples.plactic_monoid_Knu70(4)
Expand All @@ -321,6 +331,8 @@ def test_stylic_monoid_AR22():
ReportGuard(False)
with pytest.raises(LibsemigroupsError):
examples.stylic_monoid_AR22(0)

with pytest.raises(LibsemigroupsError):
examples.stylic_monoid_AR22(1)

# TODO(1) adapt for new Sims API
Expand All @@ -335,7 +347,11 @@ def test_fibonacci_semigroup_CRRT94():
ReportGuard(False)
with pytest.raises(LibsemigroupsError):
examples.fibonacci_semigroup_CRRT94(0, 1)

with pytest.raises(LibsemigroupsError):
examples.fibonacci_semigroup_CRRT94(1, 0)

with pytest.raises(LibsemigroupsError):
examples.fibonacci_semigroup_CRRT94(0, 0)

p = examples.fibonacci_semigroup_CRRT94(2, 5)
Expand All @@ -347,7 +363,11 @@ def test_temperley_lieb_monoid_Eas21():
ReportGuard(False)
with pytest.raises(LibsemigroupsError):
examples.temperley_lieb_monoid_Eas21(0)

with pytest.raises(LibsemigroupsError):
examples.temperley_lieb_monoid_Eas21(1)

with pytest.raises(LibsemigroupsError):
examples.temperley_lieb_monoid_Eas21(2)

p = examples.temperley_lieb_monoid_Eas21(8)
Expand All @@ -359,7 +379,11 @@ def test_singular_brauer_monoid_MM07():
ReportGuard(False)
with pytest.raises(LibsemigroupsError):
examples.singular_brauer_monoid_MM07(0)

with pytest.raises(LibsemigroupsError):
examples.singular_brauer_monoid_MM07(1)

with pytest.raises(LibsemigroupsError):
examples.singular_brauer_monoid_MM07(2)

p = examples.singular_brauer_monoid(6)
Expand All @@ -371,7 +395,11 @@ def test_orientation_preserving_monoid_AR00():
ReportGuard(False)
with pytest.raises(LibsemigroupsError):
examples.orientation_preserving_monoid_AR00(0)

with pytest.raises(LibsemigroupsError):
examples.orientation_preserving_monoid_AR00(1)

with pytest.raises(LibsemigroupsError):
examples.orientation_preserving_monoid_AR00(2)

p = examples.orientation_preserving_monoid_AR00(6)
Expand All @@ -383,7 +411,11 @@ def test_orientation_preserving_reversing_monoid_AR00():
ReportGuard(False)
with pytest.raises(LibsemigroupsError):
examples.orientation_preserving_reversing_monoid_AR00(0)

with pytest.raises(LibsemigroupsError):
examples.orientation_preserving_reversing_monoid_AR00(1)

with pytest.raises(LibsemigroupsError):
examples.orientation_preserving_reversing_monoid_AR00(2)

p = examples.orientation_preserving_reversing_monoid_AR00(5)
Expand Down