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
18 changes: 12 additions & 6 deletions src/libsemigroups_pybind11/detail/cxx_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
"""

from functools import update_wrapper

from inspect import isclass
from types import MethodType

from typing import Any, Callable
from typing_extensions import Self

Expand Down Expand Up @@ -240,8 +241,13 @@ def copy_cxx_mem_fns(cxx_class: pybind11_type, py_class: CxxWrapper) -> None:
if (not py_meth_name.startswith("_")) and py_meth_name not in dir(
py_class
):
setattr(
py_class,
py_meth_name,
wrap_cxx_mem_fn(getattr(cxx_class, py_meth_name)),
)
if not isclass(getattr(cxx_class, py_meth_name)):
setattr(
py_class,
py_meth_name,
wrap_cxx_mem_fn(getattr(cxx_class, py_meth_name)),
)
else:
setattr(
py_class, py_meth_name, getattr(cxx_class, py_meth_name)
)
9 changes: 9 additions & 0 deletions tests/test_knuth_bendix.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
from datetime import timedelta
import pytest

from _libsemigroups_pybind11 import Runner # pylint: disable=no-name-in-module

from libsemigroups_pybind11 import (
KnuthBendix,
LIMIT_MAX,
Expand All @@ -29,6 +31,7 @@
presentation,
)


from .runner import check_runner
from .cong_common import check_congruence_common_return_policy

Expand Down Expand Up @@ -393,6 +396,12 @@ def test_knuth_bendix_return_policy():
assert kb.gilman_graph_node_labels() is not kb.gilman_graph_node_labels()


def test_knuth_bendix_runner_state():
p = Presentation([0, 1])
kb = KnuthBendix(congruence_kind.twosided, p)
assert isinstance(kb.state(0), Runner.state)


# TODO(0) Does the alphabet bug persist? YES: the test fails
# def test_alphabet_bug():
# p = Presentation("".join(chr(i) for i in range(-126, 128)))
Expand Down