def abc_code(): a = LOAD_CONST('a') b = LOAD_CONST('b') c = LOAD_CONST('c') # not in instrs code = Code((a, b), argnames=()) return (a, b, c), code
def test_dangling_var(cls): instr = cls('dangling') with pytest.raises(ValueError) as e: Code((instr,)) assert ( str(e.value) == "Argument to %r is not in cellvars or freevars." % instr )
def test_code_multiple_kwargs(): with pytest.raises(ValueError) as e: Code( (), ( '**kwargs', '**kwargs', ), ) assert str(e.value) == 'cannot specify **kwargs more than once'