mirror of
https://github.com/pyscript/pyscript.git
synced 2026-04-30 16:00:32 -04:00
TOML Error Cases (#815)
* TOML Error Cases * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * remove traceback * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * any is a ts feature * full eslint * format and disable eslint for toml.js Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Madhur Tandon <madhurtandon23@gmail.com>
This commit is contained in:
@@ -5,7 +5,7 @@ import tempfile
|
||||
import pytest
|
||||
import requests
|
||||
|
||||
from .support import PyScriptTest
|
||||
from .support import JsError, PyScriptTest
|
||||
|
||||
URL = "https://github.com/pyodide/pyodide/releases/download/0.20.0/pyodide-build-0.20.0.tar.bz2"
|
||||
TAR_NAME = "pyodide-build-0.20.0.tar.bz2"
|
||||
@@ -69,3 +69,30 @@ class TestRuntimeConfig(PyScriptTest):
|
||||
assert self.console.log.lines == [self.PY_COMPLETE, "version 0.20.0"]
|
||||
version = self.page.locator("py-script").inner_text()
|
||||
assert version == "0.20.0"
|
||||
|
||||
def test_invalid_json_config(self):
|
||||
with pytest.raises(JsError) as exc:
|
||||
self.pyscript_run(
|
||||
snippet="",
|
||||
extra_head="""
|
||||
<py-config type="json">
|
||||
[[
|
||||
</py-config>
|
||||
""",
|
||||
)
|
||||
|
||||
msg = str(exc.value)
|
||||
assert "SyntaxError" in msg
|
||||
|
||||
def test_invalid_toml_config(self):
|
||||
with pytest.raises(JsError) as exc:
|
||||
self.pyscript_run(
|
||||
snippet="",
|
||||
extra_head="""
|
||||
<py-config>
|
||||
[[
|
||||
</py-config>
|
||||
""",
|
||||
)
|
||||
msg = str(exc)
|
||||
assert "<ExceptionInfo JsError" in msg
|
||||
|
||||
Reference in New Issue
Block a user