gradio/test/test_events.py
Abubakar Abid 5c80b544ab
Better error messages (#2543)
* events fix

* changelog, format, better error msg

* changelog

* changelog

* mix errors

* formatting

* switched from error to warnings

* typo
2022-10-26 16:10:26 -07:00

17 lines
443 B
Python

import pytest
import gradio as gr
class TestEventErrors:
def test_event_defined_invalid_scope(self):
with gr.Blocks() as demo:
textbox = gr.Textbox()
textbox.blur(lambda x: x + x, textbox, textbox)
with pytest.raises(AttributeError):
demo.load(lambda: "hello", None, textbox)
with pytest.raises(AttributeError):
textbox.change(lambda x: x + x, textbox, textbox)