mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-20 10:47:35 -05:00
detect the case in which multiple <py-config> are listed
Ideally I would like it to be a fatal error, but it's too hard to do it with the current state of the code, will refactor it later (#826)
This commit is contained in:
@@ -131,3 +131,28 @@ class TestConfig(PyScriptTest):
|
||||
)
|
||||
msg = str(exc)
|
||||
assert "<ExceptionInfo JsError" in msg
|
||||
|
||||
def test_multiple_py_config(self):
|
||||
self.pyscript_run(
|
||||
"""
|
||||
<py-config>
|
||||
name = "foobar"
|
||||
</py-config>
|
||||
|
||||
<py-config>
|
||||
this is ignored and won't even be parsed
|
||||
</py-config>
|
||||
|
||||
<py-script>
|
||||
import js
|
||||
config = js.pyscript_get_config()
|
||||
js.console.log("config name:", config.name)
|
||||
</py-script>
|
||||
"""
|
||||
)
|
||||
div = self.page.wait_for_selector(".py-error")
|
||||
expected = (
|
||||
"Multiple <py-config> tags detected. Only the first "
|
||||
"is going to be parsed, all the others will be ignored"
|
||||
)
|
||||
assert div.text_content() == expected
|
||||
|
||||
Reference in New Issue
Block a user