Skip to content

Commit 3d2a5f9

Browse files
Add missing header include in cong.cpp
1 parent 41a08fd commit 3d2a5f9

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

src/cong.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include <libsemigroups/types.hpp> // for word_type
3636

3737
// pybind11....
38+
#include <pybind11/chrono.h> // for auto conversion of py types for run_for
3839
#include <pybind11/pybind11.h> // for class_, init, make_iterator, module
3940
#include <pybind11/stl.h>
4041

@@ -50,7 +51,7 @@ namespace libsemigroups {
5051
namespace py = pybind11;
5152

5253
namespace libsemigroups {
53-
void init_cong(py::module &m) {
54+
void init_cong(py::module& m) {
5455
py::class_<Congruence>(m, "Congruence")
5556
.def(py::init<congruence_kind>(),
5657
py::arg("kind"),
@@ -85,7 +86,7 @@ namespace libsemigroups {
8586
8687
:Complexity: Linear in the size of ``S``.
8788
)pbdoc")
88-
.def(py::init<congruence_kind, FpSemigroup &>(),
89+
.def(py::init<congruence_kind, FpSemigroup&>(),
8990
py::arg("kind"),
9091
py::arg("S"),
9192
R"pbdoc(
@@ -110,7 +111,7 @@ namespace libsemigroups {
110111
&Congruence::number_of_generators,
111112
cong_intf_doc_strings::number_of_generators)
112113
.def("add_pair",
113-
py::overload_cast<word_type const &, word_type const &>(
114+
py::overload_cast<word_type const&, word_type const&>(
114115
&Congruence::add_pair),
115116
py::arg("u"),
116117
py::arg("v"),
@@ -142,8 +143,7 @@ namespace libsemigroups {
142143
py::arg("t"),
143144
runner_doc_strings::run_for)
144145
.def("run_until",
145-
(void (Congruence::*)(std::function<bool()> &))
146-
& Runner::run_until,
146+
(void (Congruence::*)(std::function<bool()>&)) & Runner::run_until,
147147
py::arg("func"),
148148
runner_doc_strings::run_until)
149149
.def("less",
@@ -169,7 +169,7 @@ namespace libsemigroups {
169169
cong_intf_doc_strings::number_of_non_trivial_classes)
170170
.def(
171171
"non_trivial_classes",
172-
[](Congruence &C, size_t i) {
172+
[](Congruence& C, size_t i) {
173173
return C.non_trivial_classes()->at(i);
174174
},
175175
py::arg("i"),
@@ -245,7 +245,7 @@ namespace libsemigroups {
245245
runner_doc_strings::stopped_by_predicate)
246246
.def(
247247
"generating_pairs",
248-
[](Congruence const &c) {
248+
[](Congruence const& c) {
249249
return py::make_iterator(c.cbegin_generating_pairs(),
250250
c.cend_generating_pairs());
251251
},

tests/test_cong.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
"""
1212

1313
# pylint: disable=no-name-in-module, missing-function-docstring, invalid-name
14-
14+
from datetime import timedelta
1515
from libsemigroups_pybind11 import (
16-
FpSemigroup,
1716
Congruence,
18-
congruence_kind,
17+
FpSemigroup,
1918
ReportGuard,
19+
congruence_kind,
2020
)
2121

2222

@@ -46,3 +46,6 @@ def test_018():
4646
assert cong.number_of_non_trivial_classes() == 1
4747
assert cong.finished()
4848
assert cong.non_trivial_classes(0) == [[0], [1], [0, 1], [1, 1], [0, 1, 1]]
49+
# The next line does nothing except check that it's possible to call
50+
# `run_for` with a timedelta
51+
cong.run_for(timedelta(seconds=1))

0 commit comments

Comments
 (0)