Skip to content

Commit 68c21f8

Browse files
Formatting + linting
1 parent 5020970 commit 68c21f8

File tree

3 files changed

+39
-16
lines changed

3 files changed

+39
-16
lines changed

libsemigroups_pybind11/action.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,9 @@ def __init__(
209209
if _to_cxx(self) is not None:
210210
return
211211
if len(args) != 0:
212-
raise ValueError(f"expected 0 positional arguments, but found {len(args)}")
212+
raise ValueError(
213+
f"expected 0 positional arguments, but found {len(args)}"
214+
)
213215
if not isinstance(generators, list):
214216
raise TypeError(
215217
"expected the keyword argument 'generators' to be "

tests/test_action.py

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
RightAction,
2121
LeftAction,
2222
Action,
23-
ImageRightAction,
2423
PPerm,
2524
BMat8,
2625
side,
@@ -228,14 +227,26 @@ def test_action_001(right_actions, left_actions):
228227
rows.init()
229228

230229
rows.add_seed(
231-
row_space_basis(BMat8([[1, 1, 1, 0], [1, 1, 0, 0], [0, 1, 0, 1], [0, 1, 0, 0]]))
230+
row_space_basis(
231+
BMat8([[1, 1, 1, 0], [1, 1, 0, 0], [0, 1, 0, 1], [0, 1, 0, 0]])
232+
)
232233
)
233234

234-
rows.add_generator(BMat8([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]))
235-
rows.add_generator(BMat8([[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]))
236-
rows.add_generator(BMat8([[0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1], [1, 0, 0, 0]]))
237-
rows.add_generator(BMat8([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [1, 0, 0, 1]]))
238-
rows.add_generator(BMat8([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 0]]))
235+
rows.add_generator(
236+
BMat8([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]])
237+
)
238+
rows.add_generator(
239+
BMat8([[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]])
240+
)
241+
rows.add_generator(
242+
BMat8([[0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1], [1, 0, 0, 0]])
243+
)
244+
rows.add_generator(
245+
BMat8([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [1, 0, 0, 1]])
246+
)
247+
rows.add_generator(
248+
BMat8([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 0]])
249+
)
239250

240251
assert len(rows) == 553
241252

@@ -249,7 +260,9 @@ def test_action_pperm(right_actions):
249260
right = right_actions[1]
250261
right.reserve(70000)
251262
assert len(right) == 65536
252-
assert repr(right) == "<complete right action with 4 generators, 65536 points>"
263+
assert (
264+
repr(right) == "<complete right action with 4 generators, 65536 points>"
265+
)
253266
assert right[666] == PPerm(
254267
[0, 2, 7, 8, 9, 10, 11, 12, 13, 14],
255268
[0, 2, 7, 8, 9, 10, 11, 12, 13, 14],
@@ -311,13 +324,15 @@ def test_action_transf(right_actions, extreme_left_actions):
311324

312325
def test_action_coverage():
313326
with pytest.raises(TypeError):
314-
Action(element=PPerm)
327+
Action(generators=PPerm)
315328

316329
with pytest.raises(TypeError):
317-
Action(BadKeywordArg=PPerm, generators=None, seeds=None, help=None)
330+
Action(generators=None, seeds=None)
318331

319332
with pytest.raises(KeyError):
320-
Action(generators=[PPerm], seeds=[BMat8], func=RightAction, side=side.left)
333+
Action(
334+
generators=[PPerm], seeds=[BMat8], func=RightAction, side=side.left
335+
)
321336

322337
right = RightAction(
323338
generators=[
@@ -352,7 +367,9 @@ def test_action_coverage():
352367
seeds=[PPerm.one(17)],
353368
)
354369

355-
assert repr(right) == "<incomplete right action with 1 generators, 1 points>"
370+
assert (
371+
repr(right) == "<incomplete right action with 1 generators, 1 points>"
372+
)
356373
with pytest.raises(TypeError):
357374
right.add_generator(BMat8(0))
358375

@@ -444,7 +461,9 @@ def test_action_reserve(right_actions, left_actions):
444461

445462
def test_action_root_of_scc(right_actions, left_actions):
446463
for action in right_actions + left_actions:
447-
expected = BMat8([[1, 1, 1, 0], [1, 1, 0, 0], [0, 1, 0, 1], [0, 1, 0, 0]])
464+
expected = BMat8(
465+
[[1, 1, 1, 0], [1, 1, 0, 0], [0, 1, 0, 1], [0, 1, 0, 0]]
466+
)
448467
assert action.root_of_scc(0) == expected
449468
assert action.root_of_scc(expected) == expected
450469
with pytest.raises(TypeError):
@@ -456,4 +475,6 @@ def test_action_word_graph(right_actions, left_actions):
456475
for action in right_actions + left_actions:
457476
wg = action.word_graph()
458477
assert wg.number_of_nodes() == len(action)
459-
assert wg.number_of_edges() == len(action) * action.number_of_generators()
478+
assert (
479+
wg.number_of_edges() == len(action) * action.number_of_generators()
480+
)

tests/test_sims.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def test_sims1_000():
105105
it = S.iterator(1)
106106
wg = next(it)
107107
assert wg == WordGraph(1, [[0, 0]])
108-
assert type(wg) is WordGraph
108+
assert isinstance(wg, WordGraph)
109109

110110
it = S.iterator(5)
111111
assert next(it) == WordGraph(5, [[0, 0]])

0 commit comments

Comments
 (0)