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

Function test_rddd001_initial_state

tests/integration/renderer/test_due_diligence.py:13–101  ·  view source on GitHub ↗
(dash_duo)

Source from the content-addressed store, hash-verified

11
12
13def test_rddd001_initial_state(dash_duo):
14 app = Dash(__name__)
15 my_class_attrs = {
16 "id": "p.c.4",
17 "className": "my-class",
18 "title": "tooltip",
19 "style": {"color": "red", "fontSize": 30},
20 }
21 # fmt:off
22 app.layout = html.Div([
23 'Basic string',
24 3.14,
25 True,
26 None,
27 html.Div('Child div with basic string', **my_class_attrs),
28 html.Div(id='p.c.5'),
29 html.Div([
30 html.Div('Grandchild div', id='p.c.6.p.c.0'),
31 html.Div([
32 html.Div('Great grandchild', id='p.c.6.p.c.1.p.c.0'),
33 3.14159,
34 'another basic string'
35 ], id='p.c.6.p.c.1'),
36 html.Div([
37 html.Div(
38 html.Div([
39 html.Div([
40 html.Div(
41 id='p.c.6.p.c.2.p.c.0.p.c.p.c.0.p.c.0'
42 ),
43 '',
44 html.Div(
45 id='p.c.6.p.c.2.p.c.0.p.c.p.c.0.p.c.2'
46 )
47 ], id='p.c.6.p.c.2.p.c.0.p.c.p.c.0')
48 ], id='p.c.6.p.c.2.p.c.0.p.c'),
49 id='p.c.6.p.c.2.p.c.0'
50 )
51 ], id='p.c.6.p.c.2')
52 ], id='p.c.6')
53 ])
54 # fmt:on
55
56 dash_duo.start_server(app)
57 dash_duo.wait_for_text_to_equal(r"#p\.c\.5", "")
58
59 # Note: this .html file shows there's no undo/redo button by default
60 with open(
61 os.path.join(os.path.dirname(__file__), "initial_state_dash_app_content.html")
62 ) as fp:
63 expected_dom = BeautifulSoup(fp.read().strip(), "lxml")
64
65 fetched_dom = dash_duo.dash_outerhtml_dom
66
67 assert (
68 fetched_dom.decode() == expected_dom.decode()
69 ), "the fetching rendered dom is expected"
70

Callers

nothing calls this directly

Calls 8

DashClass · 0.90
get_logsMethod · 0.80
findChildrenMethod · 0.80
findMethod · 0.80
start_serverMethod · 0.45
getMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…