MCPcopy
hub / github.com/streamlit/streamlit / test_button

Function test_button

lib/tests/streamlit/testing/element_tree_test.py:51–70  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

49
50
51def test_button():
52 def script():
53 import streamlit as st
54
55 st.button("button")
56 st.button("second button")
57
58 sr = AppTest.from_function(script).run()
59 assert sr.button[0].value is False
60 assert sr.button[1].value is False
61
62 sr2 = sr.button[0].click().run()
63 assert sr2.button[0].value is True
64 assert sr2.button[1].value is False
65
66 sr3 = sr2.run()
67 assert sr3.button[0].value is False
68 assert sr3.button[1].value is False
69
70 repr(sr.button[0])
71
72
73def test_chat():

Callers

nothing calls this directly

Calls 3

from_functionMethod · 0.80
runMethod · 0.45
clickMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…