mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-19 18:27:29 -05:00
* Add beforePyScriptExec, afterPyScriptExec lifecycle hooks * Add stdiodirector plugin for `output`, `stderr` attributes of py-script tag * Add docs on `output` and `stderr` attributes of py-script tag * Tests * Removed output deprecation warning for `output` attribute * Add createSingularWarning(), with createDeprecationWarning as alias
29 lines
822 B
Python
29 lines
822 B
Python
from .support import PyScriptTest
|
|
|
|
|
|
class TestWarningsAndBanners(PyScriptTest):
|
|
# Test the behavior of generated warning banners
|
|
|
|
def test_create_singular_warning(self):
|
|
# Use a script tag with an invalid output attribute to generate a warning, but only one
|
|
self.pyscript_run(
|
|
"""
|
|
<py-script output="foo">
|
|
print("one.")
|
|
print("two.")
|
|
</py-script>
|
|
<py-script output="foo">
|
|
print("three.")
|
|
</py-script>
|
|
"""
|
|
)
|
|
|
|
loc = self.page.locator(".alert-banner")
|
|
|
|
# Only one banner should appear
|
|
assert loc.count() == 1
|
|
assert (
|
|
loc.text_content()
|
|
== 'output = "foo" does not match the id of any element on the page.'
|
|
)
|