Skip to content

Commit 4b53e3e

Browse files
committed
Cleanup html tests
1 parent ca132e3 commit 4b53e3e

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

components/dash-html-components/tests/test_dash_html_components.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import pytest
2-
import dash_html_components as html
2+
import dash
3+
from dash import html
34

45

56
def test_imports():
@@ -12,8 +13,8 @@ def test_imports():
1213
dir_set = set(
1314
[
1415
d
15-
for d in dir(html)
16-
if d[0] != "_" and d[0] == d[0].capitalize()
16+
for d in dir(dash.html)
17+
if d[0] != "_" and d[0] != "@" and d[0] == d[0].capitalize()
1718
]
1819
)
1920
assert dir_set == set(elements)

components/dash-html-components/tests/test_integration.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
from multiprocessing import Value
22
import time
33

4-
import dash
5-
from dash.dependencies import Input, Output
6-
import dash_html_components as html
4+
from dash import Dash, Input, Output, html
75

86

97
def test_click_simple(dash_duo):
108
call_count = Value("i", 0)
119

12-
app = dash.Dash(__name__)
10+
app = Dash(__name__)
1311
app.layout = html.Div(
1412
[
1513
html.Div(id="container"),
@@ -29,13 +27,13 @@ def update_output(n_clicks):
2927

3028
dash_duo.wait_for_text_to_equal("#container", "clicked 0 times")
3129
assert call_count.value == 1
32-
dash_duo.percy_snapshot("button initialization")
30+
dash_duo.percy_snapshot("html button initialization")
3331

3432
dash_duo.find_element("#button").click()
3533

3634
dash_duo.wait_for_text_to_equal("#container", "clicked 1 times")
3735
assert call_count.value == 2
38-
dash_duo.percy_snapshot("button click")
36+
dash_duo.percy_snapshot("html button click")
3937

4038
assert not dash_duo.get_logs()
4139

@@ -48,7 +46,7 @@ def test_click_prev(dash_duo):
4846
timestamp_1 = Value("d", -5)
4947
timestamp_2 = Value("d", -5)
5048

51-
app = dash.Dash(__name__)
49+
app = Dash(__name__)
5250
app.layout = html.Div(
5351
[
5452
html.Div(id="container"),
@@ -79,22 +77,22 @@ def update_output(*args):
7977
assert timestamp_1.value == -1
8078
assert timestamp_2.value == -1
8179
assert call_count.value == 1
82-
dash_duo.percy_snapshot("button initialization 1")
80+
dash_duo.percy_snapshot("html button initialization 1")
8381

8482
dash_duo.find_element("#button-1").click()
8583
dash_duo.wait_for_text_to_equal("#container", "1, 0")
8684
assert timestamp_1.value > ((time.time() - (24 * 60 * 60)) * 1000)
8785
assert timestamp_2.value == -1
8886
assert call_count.value == 2
89-
dash_duo.percy_snapshot("button-1 click")
87+
dash_duo.percy_snapshot("html button-1 click")
9088
prev_timestamp_1 = timestamp_1.value
9189

9290
dash_duo.find_element("#button-2").click()
9391
dash_duo.wait_for_text_to_equal("#container", "1, 1")
9492
assert timestamp_1.value == prev_timestamp_1
9593
assert timestamp_2.value > ((time.time() - 24 * 60 * 60) * 1000)
9694
assert call_count.value == 3
97-
dash_duo.percy_snapshot("button-2 click")
95+
dash_duo.percy_snapshot("html button-2 click")
9896
prev_timestamp_2 = timestamp_2.value
9997

10098
dash_duo.find_element("#button-2").click()
@@ -103,6 +101,6 @@ def update_output(*args):
103101
assert timestamp_2.value > prev_timestamp_2
104102
assert timestamp_2.value > timestamp_1.value
105103
assert call_count.value == 4
106-
dash_duo.percy_snapshot("button-2 click again")
104+
dash_duo.percy_snapshot("html button-2 click again")
107105

108106
assert not dash_duo.get_logs()

0 commit comments

Comments
 (0)