MCPcopy
hub / github.com/plotly/dash / test_rdps001_local_reload

Function test_rdps001_local_reload

tests/integration/renderer/test_persistence.py:94–143  ·  view source on GitHub ↗
(dash_duo)

Source from the content-addressed store, hash-verified

92
93
94def test_rdps001_local_reload(dash_duo):
95 app = reloadable_app()
96 dash_duo.start_server(app)
97 dash_duo.wait_for_text_to_equal("#out", "names: [a, b]; hidden: []")
98 check_table_names(dash_duo, ["a", "b"])
99
100 rename_and_hide(dash_duo)
101 # callback output
102 dash_duo.wait_for_text_to_equal(
103 "#out", "names: [{}, b]; hidden: [c1]".format(NEW_NAME)
104 )
105 check_table_names(dash_duo, [NEW_NAME])
106
107 dash_duo.wait_for_page()
108 # callback gets persisted values, not the values provided with the layout
109 dash_duo.wait_for_text_to_equal(
110 "#out", "names: [{}, b]; hidden: [c1]".format(NEW_NAME)
111 )
112 check_table_names(dash_duo, [NEW_NAME])
113
114 # new persistence reverts
115 app.persistence.value = 2
116 dash_duo.wait_for_page()
117 check_table_names(dash_duo, ["a", "b"])
118 rename_and_hide(dash_duo, 1, "two", 0)
119 dash_duo.wait_for_text_to_equal("#out", "names: [a, two]; hidden: [c0]")
120 check_table_names(dash_duo, ["two"])
121
122 # put back the old persistence, get the old values
123 app.persistence.value = 1
124 dash_duo.wait_for_page()
125 dash_duo.wait_for_text_to_equal(
126 "#out", "names: [{}, b]; hidden: [c1]".format(NEW_NAME)
127 )
128 check_table_names(dash_duo, [NEW_NAME])
129
130 # falsy persistence disables it
131 app.persistence.value = 0
132 dash_duo.wait_for_page()
133 check_table_names(dash_duo, ["a", "b"])
134 rename_and_hide(dash_duo)
135 check_table_names(dash_duo, [NEW_NAME])
136 dash_duo.wait_for_page()
137 check_table_names(dash_duo, ["a", "b"])
138
139 # falsy to previous truthy also brings the values
140 app.persistence.value = 2
141 dash_duo.wait_for_page()
142 dash_duo.wait_for_text_to_equal("#out", "names: [a, two]; hidden: [c0]")
143 check_table_names(dash_duo, ["two"])
144
145
146def test_rdps002_session_reload(dash_duo):

Callers

nothing calls this directly

Calls 7

reloadable_appFunction · 0.85
check_table_namesFunction · 0.85
rename_and_hideFunction · 0.85
wait_for_pageMethod · 0.80
start_serverMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…