Closed eclipseo closed 2 years ago
python-Automat fails to build with Python 3.11.0a4.
=================================== FAILURES =================================== ______________ MethodicalTests.test_badTransitionForCurrentState _______________ self = <automat._test.test_methodical.MethodicalTests testMethod=test_badTransitionForCurrentState> def test_badTransitionForCurrentState(self): """ Calling any input method that lacks a transition for the machine's current state raises an informative L{NoTransition}. """ class OnlyOnePath(object): m = MethodicalMachine() @m.state(initial=True) def start(self): "Start state." @m.state() def end(self): "End state." @m.input() def advance(self): "Move from start to end." @m.input() def deadEnd(self): "A transition from nowhere to nowhere." start.upon(advance, end, []) machine = OnlyOnePath() with self.assertRaises(NoTransition) as cm: > machine.deadEnd() automat/_test/test_methodical.py:466: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ automat/_methodical.py:232: in __get__ @preserveName(self.method) automat/_introspection.py:43: in decorator return copyfunction(decorated, automat/_introspection.py:35: in copyfunction return function(copycode(template.__code__, codechanges), *values) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ def copycode(template, changes): names = [ "argcount", "nlocals", "stacksize", "flags", "code", "consts", "names", "varnames", "filename", "name", "firstlineno", "lnotab", "freevars", "cellvars" ] if hasattr(code, "co_kwonlyargcount"): names.insert(1, "kwonlyargcount") if hasattr(code, "co_posonlyargcount"): # PEP 570 added "positional only arguments" names.insert(1, "posonlyargcount") values = [ changes.get(name, getattr(template, "co_" + name)) for name in names ] > return code(*values) E TypeError: code expected at least 18 arguments, got 16 automat/_introspection.py:23: TypeError _____________________ MethodicalTests.test_collectOutputs ______________________ self = <automat._test.test_methodical.MethodicalTests testMethod=test_collectOutputs> def test_collectOutputs(self): """ Outputs can be combined with the "collector" argument to "upon". """ import operator class Machine(object): m = MethodicalMachine() @m.input() def input(self): "an input" @m.output() def outputA(self): return "A" @m.output() def outputB(self): return "B" @m.state(initial=True) def state(self): "a state" state.upon(input, state, [outputA, outputB], collector=lambda x: reduce(operator.add, x)) m = Machine() > self.assertEqual(m.input(), "AB") automat/_test/test_methodical.py:171: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ automat/_methodical.py:232: in __get__ @preserveName(self.method) automat/_introspection.py:43: in decorator return copyfunction(decorated, automat/_introspection.py:35: in copyfunction return function(copycode(template.__code__, codechanges), *values) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ template = <code object doInput at 0x7f184dce8030, file "/builddir/build/BUILD/Automat-20.2.0/automat/_methodical.py", line 232> changes = {'name': 'input'} def copycode(template, changes): names = [ "argcount", "nlocals", "stacksize", "flags", "code", "consts", "names", "varnames", "filename", "name", "firstlineno", "lnotab", "freevars", "cellvars" ] if hasattr(code, "co_kwonlyargcount"): names.insert(1, "kwonlyargcount") if hasattr(code, "co_posonlyargcount"): # PEP 570 added "positional only arguments" names.insert(1, "posonlyargcount") values = [ changes.get(name, getattr(template, "co_" + name)) for name in names ] > return code(*values) E TypeError: code expected at least 18 arguments, got 16 automat/_introspection.py:23: TypeError ________________ MethodicalTests.test_inputFunctionsMustBeEmpty ________________ self = <automat._test.test_methodical.MethodicalTests testMethod=test_inputFunctionsMustBeEmpty> def test_inputFunctionsMustBeEmpty(self): """ The wrapped input function must have an empty body. """ # input functions are executed to assert that the signature matches, # but their body must be empty _methodical._empty() # chase coverage _methodical._docstring() class Mechanism(object): m = MethodicalMachine() with self.assertRaises(ValueError) as cm: @m.input() def input(self): "an input" list() # pragma: no cover self.assertEqual(str(cm.exception), "function body must be empty") # all three of these cases should be valid. Functions/methods with # docstrings produce slightly different bytecode than ones without. class MechanismWithDocstring(object): m = MethodicalMachine() @m.input() def input(self): "an input" @m.state(initial=True) def start(self): "starting state" start.upon(input, enter=start, outputs=[]) > MechanismWithDocstring().input() automat/_test/test_methodical.py:294: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ automat/_methodical.py:232: in __get__ @preserveName(self.method) automat/_introspection.py:43: in decorator return copyfunction(decorated, automat/_introspection.py:35: in copyfunction return function(copycode(template.__code__, codechanges), *values) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ template = <code object doInput at 0x7f184dce8030, file "/builddir/build/BUILD/Automat-20.2.0/automat/_methodical.py", line 232> changes = {'name': 'input'} def copycode(template, changes): names = [ "argcount", "nlocals", "stacksize", "flags", "code", "consts", "names", "varnames", "filename", "name", "firstlineno", "lnotab", "freevars", "cellvars" ] if hasattr(code, "co_kwonlyargcount"): names.insert(1, "kwonlyargcount") if hasattr(code, "co_posonlyargcount"): # PEP 570 added "positional only arguments" names.insert(1, "posonlyargcount") values = [ changes.get(name, getattr(template, "co_" + name)) for name in names ] > return code(*values) E TypeError: code expected at least 18 arguments, got 16 automat/_introspection.py:23: TypeError ___________________ MethodicalTests.test_inputWithArguments ____________________ self = <automat._test.test_methodical.MethodicalTests testMethod=test_inputWithArguments> def test_inputWithArguments(self): """ If an input takes an argument, it will pass that along to its output. """ class Mechanism(object): m = MethodicalMachine() @m.input() def input(self, x, y=1): "an input" @m.state(initial=True) def state(self): "a state" @m.output() def output(self, x, y=1): self._x = x return x + y state.upon(input, state, [output]) m = Mechanism() > self.assertEqual(m.input(3), [4]) automat/_test/test_methodical.py:211: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ automat/_methodical.py:232: in __get__ @preserveName(self.method) automat/_introspection.py:43: in decorator return copyfunction(decorated, automat/_introspection.py:35: in copyfunction return function(copycode(template.__code__, codechanges), *values) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ template = <code object doInput at 0x7f184dce8030, file "/builddir/build/BUILD/Automat-20.2.0/automat/_methodical.py", line 232> changes = {'name': 'input'} def copycode(template, changes): names = [ "argcount", "nlocals", "stacksize", "flags", "code", "consts", "names", "varnames", "filename", "name", "firstlineno", "lnotab", "freevars", "cellvars" ] if hasattr(code, "co_kwonlyargcount"): names.insert(1, "kwonlyargcount") if hasattr(code, "co_posonlyargcount"): # PEP 570 added "positional only arguments" names.insert(1, "posonlyargcount") values = [ changes.get(name, getattr(template, "co_" + name)) for name in names ] > return code(*values) E TypeError: code expected at least 18 arguments, got 16 automat/_introspection.py:23: TypeError _______________________ MethodicalTests.test_methodName ________________________ self = <automat._test.test_methodical.MethodicalTests testMethod=test_methodName> def test_methodName(self): """ Input methods preserve their declared names. """ class Mech(object): m = MethodicalMachine() @m.input() def declaredInputName(self): "an input" @m.state(initial=True) def aState(self): "state" m = Mech() with self.assertRaises(TypeError) as cm: m.declaredInputName("too", "many", "arguments") > self.assertIn("declaredInputName", str(cm.exception)) E AssertionError: 'declaredInputName' not found in 'code expected at least 18 arguments, got 16' automat/_test/test_methodical.py:189: AssertionError ____________________ MethodicalTests.test_multipleMachines _____________________ self = <automat._test.test_methodical.MethodicalTests testMethod=test_multipleMachines> def test_multipleMachines(self): """ Two machines may co-exist happily on the same instance; they don't interfere with each other. """ class MultiMach(object): a = MethodicalMachine() b = MethodicalMachine() @a.input() def inputA(self): "input A" @b.input() def inputB(self): "input B" @a.state(initial=True) def initialA(self): "initial A" @b.state(initial=True) def initialB(self): "initial B" @a.output() def outputA(self): return "A" @b.output() def outputB(self): return "B" initialA.upon(inputA, initialA, [outputA]) initialB.upon(inputB, initialB, [outputB]) mm = MultiMach() > self.assertEqual(mm.inputA(), ["A"]) automat/_test/test_methodical.py:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ automat/_methodical.py:232: in __get__ @preserveName(self.method) automat/_introspection.py:43: in decorator return copyfunction(decorated, automat/_introspection.py:35: in copyfunction return function(copycode(template.__code__, codechanges), *values) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ template = <code object doInput at 0x7f184dce8030, file "/builddir/build/BUILD/Automat-20.2.0/automat/_methodical.py", line 232> changes = {'name': 'inputA'} def copycode(template, changes): names = [ "argcount", "nlocals", "stacksize", "flags", "code", "consts", "names", "varnames", "filename", "name", "firstlineno", "lnotab", "freevars", "cellvars" ] if hasattr(code, "co_kwonlyargcount"): names.insert(1, "kwonlyargcount") if hasattr(code, "co_posonlyargcount"): # PEP 570 added "positional only arguments" names.insert(1, "posonlyargcount") values = [ changes.get(name, getattr(template, "co_" + name)) for name in names ] > return code(*values) E TypeError: code expected at least 18 arguments, got 16 automat/_introspection.py:23: TypeError ______________________ MethodicalTests.test_oneTransition ______________________ self = <automat._test.test_methodical.MethodicalTests testMethod=test_oneTransition> def test_oneTransition(self): """ L{MethodicalMachine} provides a way for you to declare a state machine with inputs, outputs, and states as methods. When you have declared an input, an output, and a state, calling the input method in that state will produce the specified output. """ class Machination(object): machine = MethodicalMachine() @machine.input() def anInput(self): "an input" @machine.output() def anOutput(self): "an output" return "an-output-value" @machine.output() def anotherOutput(self): "another output" return "another-output-value" @machine.state(initial=True) def anState(self): "a state" @machine.state() def anotherState(self): "another state" anState.upon(anInput, enter=anotherState, outputs=[anOutput]) anotherState.upon(anInput, enter=anotherState, outputs=[anotherOutput]) m = Machination() > self.assertEqual(m.anInput(), ["an-output-value"]) automat/_test/test_methodical.py:56: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ automat/_methodical.py:232: in __get__ @preserveName(self.method) automat/_introspection.py:43: in decorator return copyfunction(decorated, automat/_introspection.py:35: in copyfunction return function(copycode(template.__code__, codechanges), *values) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ template = <code object doInput at 0x7f184dce8030, file "/builddir/build/BUILD/Automat-20.2.0/automat/_methodical.py", line 232> changes = {'name': 'anInput'} def copycode(template, changes): names = [ "argcount", "nlocals", "stacksize", "flags", "code", "consts", "names", "varnames", "filename", "name", "firstlineno", "lnotab", "freevars", "cellvars" ] if hasattr(code, "co_kwonlyargcount"): names.insert(1, "kwonlyargcount") if hasattr(code, "co_posonlyargcount"): # PEP 570 added "positional only arguments" names.insert(1, "posonlyargcount") values = [ changes.get(name, getattr(template, "co_" + name)) for name in names ] > return code(*values) E TypeError: code expected at least 18 arguments, got 16 automat/_introspection.py:23: TypeError _______________ MethodicalTests.test_outputWithSubsetOfArguments _______________ self = <automat._test.test_methodical.MethodicalTests testMethod=test_outputWithSubsetOfArguments> def test_outputWithSubsetOfArguments(self): """ Inputs pass arguments that output will accept. """ class Mechanism(object): m = MethodicalMachine() @m.input() def input(self, x, y=1): "an input" @m.state(initial=True) def state(self): "a state" @m.output() def outputX(self, x): self._x = x return x @m.output() def outputY(self, y): self._y = y return y @m.output() def outputNoArgs(self): return None state.upon(input, state, [outputX, outputY, outputNoArgs]) m = Mechanism() # Pass x as positional argument. > self.assertEqual(m.input(3), [3, 1, None]) automat/_test/test_methodical.py:243: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ automat/_methodical.py:232: in __get__ @preserveName(self.method) automat/_introspection.py:43: in decorator return copyfunction(decorated, automat/_introspection.py:35: in copyfunction return function(copycode(template.__code__, codechanges), *values) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ template = <code object doInput at 0x7f184dce8030, file "/builddir/build/BUILD/Automat-20.2.0/automat/_methodical.py", line 232> changes = {'name': 'input'} def copycode(template, changes): names = [ "argcount", "nlocals", "stacksize", "flags", "code", "consts", "names", "varnames", "filename", "name", "firstlineno", "lnotab", "freevars", "cellvars" ] if hasattr(code, "co_kwonlyargcount"): names.insert(1, "kwonlyargcount") if hasattr(code, "co_posonlyargcount"): # PEP 570 added "positional only arguments" names.insert(1, "posonlyargcount") values = [ changes.get(name, getattr(template, "co_" + name)) for name in names ] > return code(*values) E TypeError: code expected at least 18 arguments, got 16 automat/_introspection.py:23: TypeError ____________________ MethodicalTests.test_outputsArePrivate ____________________ self = <automat._test.test_methodical.MethodicalTests testMethod=test_outputsArePrivate> def test_outputsArePrivate(self): """ One of the benefits of using a state machine is that your output method implementations don't need to take invalid state transitions into account - the methods simply won't be called. This property would be broken if client code called output methods directly, so output methods are not directly visible under their names. """ class Machination(object): machine = MethodicalMachine() counter = 0 @machine.input() def anInput(self): "an input" @machine.output() def anOutput(self): self.counter += 1 @machine.state(initial=True) def state(self): "a machine state" state.upon(anInput, enter=state, outputs=[anOutput]) mach1 = Machination() > mach1.anInput() automat/_test/test_methodical.py:100: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ automat/_methodical.py:232: in __get__ @preserveName(self.method) automat/_introspection.py:43: in decorator return copyfunction(decorated, automat/_introspection.py:35: in copyfunction return function(copycode(template.__code__, codechanges), *values) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ template = <code object doInput at 0x7f184dce8030, file "/builddir/build/BUILD/Automat-20.2.0/automat/_methodical.py", line 232> changes = {'name': 'anInput'} def copycode(template, changes): names = [ "argcount", "nlocals", "stacksize", "flags", "code", "consts", "names", "varnames", "filename", "name", "firstlineno", "lnotab", "freevars", "cellvars" ] if hasattr(code, "co_kwonlyargcount"): names.insert(1, "kwonlyargcount") if hasattr(code, "co_posonlyargcount"): # PEP 570 added "positional only arguments" names.insert(1, "posonlyargcount") values = [ changes.get(name, getattr(template, "co_" + name)) for name in names ] > return code(*values) E TypeError: code expected at least 18 arguments, got 16 automat/_introspection.py:23: TypeError ______________________ MethodicalTests.test_restoreState _______________________ self = <automat._test.test_methodical.MethodicalTests testMethod=test_restoreState> def test_restoreState(self): """ L{MethodicalMachine.unserializer} decorates a function that becomes a machine-state unserializer; its return value is mapped to the C{serialized} parameter to C{state}, and the L{MethodicalMachine} associated with that instance's state is updated to that state. """ class Mechanism(object): m = MethodicalMachine() def __init__(self): self.value = 1 self.ranOutput = False @m.state(serialized="first-state", initial=True) def first(self): "First state." @m.state(serialized="second-state") def second(self): "Second state." @m.input() def input(self): "an input" @m.output() def output(self): self.value = 2 self.ranOutput = True return 1 @m.output() def output2(self): return 2 first.upon(input, second, [output], collector=lambda x: list(x)[0]) second.upon(input, second, [output2], collector=lambda x: list(x)[0]) @m.serializer() def save(self, state): return { 'machine-state': state, 'some-value': self.value, } @m.unserializer() def _restore(self, blob): self.value = blob['some-value'] return blob['machine-state'] @classmethod def fromBlob(cls, blob): self = cls() self._restore(blob) return self m1 = Mechanism() > m1.input() automat/_test/test_methodical.py:563: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ automat/_methodical.py:232: in __get__ @preserveName(self.method) automat/_introspection.py:43: in decorator return copyfunction(decorated, automat/_introspection.py:35: in copyfunction return function(copycode(template.__code__, codechanges), *values) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ template = <code object doInput at 0x7f184dce8030, file "/builddir/build/BUILD/Automat-20.2.0/automat/_methodical.py", line 232> changes = {'name': 'input'} def copycode(template, changes): names = [ "argcount", "nlocals", "stacksize", "flags", "code", "consts", "names", "varnames", "filename", "name", "firstlineno", "lnotab", "freevars", "cellvars" ] if hasattr(code, "co_kwonlyargcount"): names.insert(1, "kwonlyargcount") if hasattr(code, "co_posonlyargcount"): # PEP 570 added "positional only arguments" names.insert(1, "posonlyargcount") values = [ changes.get(name, getattr(template, "co_" + name)) for name in names ] > return code(*values) E TypeError: code expected at least 18 arguments, got 16 automat/_introspection.py:23: TypeError ______________________ TraceTests.test_inputs_and_outputs ______________________ self = <automat._test.test_trace.TraceTests testMethod=test_inputs_and_outputs> def test_inputs_and_outputs(self): traces = [] def tracer(old_state, input, new_state): traces.append((old_state, input, new_state, None)) def trace_outputs(output): traces.append((old_state, input, new_state, output)) return trace_outputs # "I care about outputs too" s = SampleObject() s.setTrace(tracer) > s.go1() automat/_test/test_trace.py:75: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ automat/_methodical.py:232: in __get__ @preserveName(self.method) automat/_introspection.py:43: in decorator return copyfunction(decorated, automat/_introspection.py:35: in copyfunction return function(copycode(template.__code__, codechanges), *values) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ template = <code object doInput at 0x7f184dce8030, file "/builddir/build/BUILD/Automat-20.2.0/automat/_methodical.py", line 232> changes = {'name': 'go1'} def copycode(template, changes): names = [ "argcount", "nlocals", "stacksize", "flags", "code", "consts", "names", "varnames", "filename", "name", "firstlineno", "lnotab", "freevars", "cellvars" ] if hasattr(code, "co_kwonlyargcount"): names.insert(1, "kwonlyargcount") if hasattr(code, "co_posonlyargcount"): # PEP 570 added "positional only arguments" names.insert(1, "posonlyargcount") values = [ changes.get(name, getattr(template, "co_" + name)) for name in names ] > return code(*values) E TypeError: code expected at least 18 arguments, got 16 automat/_introspection.py:23: TypeError _________________________ TraceTests.test_only_inputs __________________________ self = <automat._test.test_trace.TraceTests testMethod=test_only_inputs> def test_only_inputs(self): traces = [] def tracer(old_state, input, new_state): traces.append((old_state, input, new_state)) return None # "I only care about inputs, not outputs" s = SampleObject() s.setTrace(tracer) > s.go1() automat/_test/test_trace.py:47: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ automat/_methodical.py:232: in __get__ @preserveName(self.method) automat/_introspection.py:43: in decorator return copyfunction(decorated, automat/_introspection.py:35: in copyfunction return function(copycode(template.__code__, codechanges), *values) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ template = <code object doInput at 0x7f184dce8030, file "/builddir/build/BUILD/Automat-20.2.0/automat/_methodical.py", line 232> changes = {'name': 'go1'} def copycode(template, changes): names = [ "argcount", "nlocals", "stacksize", "flags", "code", "consts", "names", "varnames", "filename", "name", "firstlineno", "lnotab", "freevars", "cellvars" ] if hasattr(code, "co_kwonlyargcount"): names.insert(1, "kwonlyargcount") if hasattr(code, "co_posonlyargcount"): # PEP 570 added "positional only arguments" names.insert(1, "posonlyargcount") values = [ changes.get(name, getattr(template, "co_" + name)) for name in names ] > return code(*values) E TypeError: code expected at least 18 arguments, got 16 automat/_introspection.py:23: TypeError _____________________ IntegrationTests.test_validGraphviz ______________________ self = <automat._test.test_visualize.IntegrationTests testMethod=test_validGraphviz> def test_validGraphviz(self): """ L{graphviz} emits valid graphviz data. """ p = subprocess.Popen("dot", stdin=subprocess.PIPE, stdout=subprocess.PIPE) > out, err = p.communicate("".join(sampleMachine().asDigraph()) .encode("utf-8")) automat/_test/test_visualize.py:229: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ automat/_test/test_visualize.py:60: in sampleMachine so.go() automat/_methodical.py:232: in __get__ @preserveName(self.method) automat/_introspection.py:43: in decorator return copyfunction(decorated, automat/_introspection.py:35: in copyfunction return function(copycode(template.__code__, codechanges), *values) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ template = <code object doInput at 0x7f184dce8030, file "/builddir/build/BUILD/Automat-20.2.0/automat/_methodical.py", line 232> changes = {'name': 'go'} def copycode(template, changes): names = [ "argcount", "nlocals", "stacksize", "flags", "code", "consts", "names", "varnames", "filename", "name", "firstlineno", "lnotab", "freevars", "cellvars" ] if hasattr(code, "co_kwonlyargcount"): names.insert(1, "kwonlyargcount") if hasattr(code, "co_posonlyargcount"): # PEP 570 added "positional only arguments" names.insert(1, "posonlyargcount") values = [ changes.get(name, getattr(template, "co_" + name)) for name in names ] > return code(*values) E TypeError: code expected at least 18 arguments, got 16 automat/_introspection.py:23: TypeError ___________________ SpotChecks.test_containsMachineFeatures ____________________ self = <automat._test.test_visualize.SpotChecks testMethod=test_containsMachineFeatures> def test_containsMachineFeatures(self): """ The output of L{graphviz} should contain the names of the states, inputs, outputs in the state machine. """ > gvout = "".join(sampleMachine().asDigraph()) automat/_test/test_visualize.py:246: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ automat/_test/test_visualize.py:60: in sampleMachine so.go() automat/_methodical.py:232: in __get__ @preserveName(self.method) automat/_introspection.py:43: in decorator return copyfunction(decorated, automat/_introspection.py:35: in copyfunction return function(copycode(template.__code__, codechanges), *values) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ template = <code object doInput at 0x7f184dce8030, file "/builddir/build/BUILD/Automat-20.2.0/automat/_methodical.py", line 232> changes = {'name': 'go'} def copycode(template, changes): names = [ "argcount", "nlocals", "stacksize", "flags", "code", "consts", "names", "varnames", "filename", "name", "firstlineno", "lnotab", "freevars", "cellvars" ] if hasattr(code, "co_kwonlyargcount"): names.insert(1, "kwonlyargcount") if hasattr(code, "co_posonlyargcount"): # PEP 570 added "positional only arguments" names.insert(1, "posonlyargcount") values = [ changes.get(name, getattr(template, "co_" + name)) for name in names ] > return code(*values) E TypeError: code expected at least 18 arguments, got 16 automat/_introspection.py:23: TypeError =========================== short test summary info ============================ FAILED automat/_test/test_methodical.py::MethodicalTests::test_badTransitionForCurrentState FAILED automat/_test/test_methodical.py::MethodicalTests::test_collectOutputs FAILED automat/_test/test_methodical.py::MethodicalTests::test_inputFunctionsMustBeEmpty FAILED automat/_test/test_methodical.py::MethodicalTests::test_inputWithArguments FAILED automat/_test/test_methodical.py::MethodicalTests::test_methodName - A... FAILED automat/_test/test_methodical.py::MethodicalTests::test_multipleMachines FAILED automat/_test/test_methodical.py::MethodicalTests::test_oneTransition FAILED automat/_test/test_methodical.py::MethodicalTests::test_outputWithSubsetOfArguments FAILED automat/_test/test_methodical.py::MethodicalTests::test_outputsArePrivate FAILED automat/_test/test_methodical.py::MethodicalTests::test_restoreState FAILED automat/_test/test_trace.py::TraceTests::test_inputs_and_outputs - Typ... FAILED automat/_test/test_trace.py::TraceTests::test_only_inputs - TypeError:... FAILED automat/_test/test_visualize.py::IntegrationTests::test_validGraphviz FAILED automat/_test/test_visualize.py::SpotChecks::test_containsMachineFeatures ======================== 14 failed, 47 passed in 0.48s =========================
Python 3.11 introduces codeobject.co_positions() (https://docs.python.org/3.11/whatsnew/3.11.html / https://www.python.org/dev/peps/pep-0657/) and co_qualname (https://bugs.python.org/issue44530).
Despite my best efforts and limited Python knowledge, I have been unable to patch the code like the last time, the fact co_positions() is a function seems to cause issue.
CPython 3.8 added code.replace for these use cases.
python-Automat fails to build with Python 3.11.0a4.
Python 3.11 introduces codeobject.co_positions() (https://docs.python.org/3.11/whatsnew/3.11.html / https://www.python.org/dev/peps/pep-0657/) and co_qualname (https://bugs.python.org/issue44530).
Despite my best efforts and limited Python knowledge, I have been unable to patch the code like the last time, the fact co_positions() is a function seems to cause issue.