mirror of https://github.com/pyodide/pyodide.git
Fix command compiler test (#1675)
This commit is contained in:
parent
447da28e80
commit
ee25dc729c
|
@ -14,24 +14,24 @@ from pyodide import CodeRunner
|
|||
def test_command_compiler():
|
||||
c = _CodeRunnerCompile()
|
||||
with pytest.raises(SyntaxError, match="unexpected EOF while parsing"):
|
||||
c("def test():\n 1", "<input>", "exec")
|
||||
assert isinstance(c("def test():\n 1\n", "<input>", "exec"), CodeRunner)
|
||||
c("def test():\n 1", "<input>", "single")
|
||||
assert isinstance(c("def test():\n 1\n", "<input>", "single"), CodeRunner)
|
||||
with pytest.raises(SyntaxError, match="invalid syntax"):
|
||||
c("1<>2", "<input>", "exec")
|
||||
c("1<>2", "<input>", "single")
|
||||
assert isinstance(
|
||||
c("from __future__ import barry_as_FLUFL", "<input>", "exec"), CodeRunner
|
||||
c("from __future__ import barry_as_FLUFL", "<input>", "single"), CodeRunner
|
||||
)
|
||||
assert isinstance(c("1<>2", "<input>", "exec"), CodeRunner)
|
||||
assert isinstance(c("1<>2", "<input>", "single"), CodeRunner)
|
||||
|
||||
c = _CodeRunnerCommandCompiler()
|
||||
assert c("def test():\n 1", "<input>", "exec") is None
|
||||
assert isinstance(c("def test():\n 1\n", "<input>", "exec"), CodeRunner)
|
||||
assert c("def test():\n 1", "<input>", "single") is None
|
||||
assert isinstance(c("def test():\n 1\n", "<input>", "single"), CodeRunner)
|
||||
with pytest.raises(SyntaxError, match="invalid syntax"):
|
||||
c("1<>2", "<input>", "exec")
|
||||
c("1<>2", "<input>", "single")
|
||||
assert isinstance(
|
||||
c("from __future__ import barry_as_FLUFL", "<input>", "exec"), CodeRunner
|
||||
c("from __future__ import barry_as_FLUFL", "<input>", "single"), CodeRunner
|
||||
)
|
||||
assert isinstance(c("1<>2", "<input>", "exec"), CodeRunner)
|
||||
assert isinstance(c("1<>2", "<input>", "single"), CodeRunner)
|
||||
|
||||
|
||||
def test_stream_redirection():
|
||||
|
|
Loading…
Reference in New Issue