Skip to content

Commit 0f112b3

Browse files
committed
Run black on components from main npm run format.
1 parent d1db799 commit 0f112b3

File tree

6 files changed

+63
-75
lines changed

6 files changed

+63
-75
lines changed

Diff for: components/dash-core-components/tests/integration/dropdown/test_remove_option.py

+36-44
Original file line numberDiff line numberDiff line change
@@ -15,78 +15,70 @@ def test_ddro001_remove_option_single(dash_dcc):
1515
dropdown_options = sample_dropdown_options
1616

1717
app = Dash(__name__)
18-
value = 'SF'
19-
20-
app.layout = html.Div([
21-
dcc.Dropdown(
22-
options=dropdown_options,
23-
value=value,
24-
id='dropdown',
25-
),
26-
html.Button('Remove option', id='remove'),
27-
html.Div(id='value-output')
28-
])
29-
30-
@app.callback(
31-
Output('dropdown', 'options'),
32-
[Input('remove', 'n_clicks')]
18+
value = "SF"
19+
20+
app.layout = html.Div(
21+
[
22+
dcc.Dropdown(
23+
options=dropdown_options,
24+
value=value,
25+
id="dropdown",
26+
),
27+
html.Button("Remove option", id="remove"),
28+
html.Div(id="value-output"),
29+
]
3330
)
31+
32+
@app.callback(Output("dropdown", "options"), [Input("remove", "n_clicks")])
3433
def on_click(n_clicks):
3534
if not n_clicks:
3635
raise PreventUpdate
3736
return sample_dropdown_options[:-1]
3837

39-
@app.callback(
40-
Output('value-output', 'children'),
41-
[Input('dropdown', 'value')]
42-
)
38+
@app.callback(Output("value-output", "children"), [Input("dropdown", "value")])
4339
def on_change(val):
4440
if not val:
4541
raise PreventUpdate
46-
return val or 'None'
42+
return val or "None"
4743

4844
dash_dcc.start_server(app)
49-
btn = dash_dcc.wait_for_element('#remove')
45+
btn = dash_dcc.wait_for_element("#remove")
5046
btn.click()
5147

52-
dash_dcc.wait_for_text_to_equal('#value-output', 'None')
48+
dash_dcc.wait_for_text_to_equal("#value-output", "None")
5349

5450

5551
def test_ddro002_remove_option_multi(dash_dcc):
5652
dropdown_options = sample_dropdown_options
5753

5854
app = Dash(__name__)
59-
value = ['MTL', 'SF']
60-
61-
app.layout = html.Div([
62-
dcc.Dropdown(
63-
options=dropdown_options,
64-
value=value,
65-
multi=True,
66-
id='dropdown',
67-
),
68-
html.Button('Remove option', id='remove'),
69-
html.Div(id='value-output')
70-
])
71-
72-
@app.callback(
73-
Output('dropdown', 'options'),
74-
[Input('remove', 'n_clicks')]
55+
value = ["MTL", "SF"]
56+
57+
app.layout = html.Div(
58+
[
59+
dcc.Dropdown(
60+
options=dropdown_options,
61+
value=value,
62+
multi=True,
63+
id="dropdown",
64+
),
65+
html.Button("Remove option", id="remove"),
66+
html.Div(id="value-output"),
67+
]
7568
)
69+
70+
@app.callback(Output("dropdown", "options"), [Input("remove", "n_clicks")])
7671
def on_click(n_clicks):
7772
if not n_clicks:
7873
raise PreventUpdate
7974
return sample_dropdown_options[:-1]
8075

81-
@app.callback(
82-
Output('value-output', 'children'),
83-
[Input('dropdown', 'value')]
84-
)
76+
@app.callback(Output("value-output", "children"), [Input("dropdown", "value")])
8577
def on_change(val):
8678
return json.dumps(val)
8779

8880
dash_dcc.start_server(app)
89-
btn = dash_dcc.wait_for_element('#remove')
81+
btn = dash_dcc.wait_for_element("#remove")
9082
btn.click()
9183

92-
dash_dcc.wait_for_text_to_equal('#value-output', '["MTL"]')
84+
dash_dcc.wait_for_text_to_equal("#value-output", '["MTL"]')

Diff for: components/dash-html-components/dash_html_components_base/__init__.py

+11-11
Original file line numberDiff line numberDiff line change
@@ -33,27 +33,27 @@
3333

3434
_js_dist = [
3535
{
36-
"relative_package_path": 'html/{}.min.js'.format(_this_module),
36+
"relative_package_path": "html/{}.min.js".format(_this_module),
3737
"external_url": (
3838
"https://unpkg.com/dash-html-components@{}"
3939
"/dash_html_components/dash_html_components.min.js"
4040
).format(__version__),
41-
"namespace": "dash"
41+
"namespace": "dash",
4242
},
4343
{
44-
'relative_package_path': 'html/{}.min.js.map'.format(_this_module),
45-
'external_url': (
46-
'https://unpkg.com/dash-html-components@{}'
47-
'/dash_html_components/dash_html_components.min.js.map'
44+
"relative_package_path": "html/{}.min.js.map".format(_this_module),
45+
"external_url": (
46+
"https://unpkg.com/dash-html-components@{}"
47+
"/dash_html_components/dash_html_components.min.js.map"
4848
).format(__version__),
49-
'namespace': 'dash',
50-
'dynamic': True
51-
}
49+
"namespace": "dash",
50+
"dynamic": True,
51+
},
5252
]
5353

5454
_css_dist = []
5555

5656

5757
for _component in __all__:
58-
setattr(locals()[_component], '_js_dist', _js_dist)
59-
setattr(locals()[_component], '_css_dist', _css_dist)
58+
setattr(locals()[_component], "_js_dist", _js_dist)
59+
setattr(locals()[_component], "_css_dist", _css_dist)

Diff for: components/dash-html-components/setup.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22
import json
33
from setuptools import setup
44

5-
with open('package.json') as f:
5+
with open("package.json") as f:
66
package = json.load(f)
77

88
package_name = str(package["name"].replace(" ", "_").replace("-", "_"))
99

1010
setup(
11-
name='dash_html_components',
11+
name="dash_html_components",
1212
version=package["version"],
13-
author=package['author'],
14-
author_email='[email protected]',
13+
author=package["author"],
14+
author_email="[email protected]",
1515
packages=[package_name],
16-
url='https://github.com/plotly/dash-html-components',
16+
url="https://github.com/plotly/dash-html-components",
1717
include_package_data=True,
18-
license=package['license'],
19-
description=package['description'] if 'description' in package else package_name,
20-
long_description=io.open('README.md', encoding='utf-8').read(),
21-
long_description_content_type='text/markdown',
22-
install_requires=[]
18+
license=package["license"],
19+
description=package["description"] if "description" in package else package_name,
20+
long_description=io.open("README.md", encoding="utf-8").read(),
21+
long_description_content_type="text/markdown",
22+
install_requires=[],
2323
)

Diff for: components/dash-html-components/tests/test_dash_html_components.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def test_imports():
2323
def test_sample_items():
2424
layout = html.Div(
2525
html.Div(html.Img(src="https://plotly.com/~chris/1638.png")),
26-
style={"color": "red"}
26+
style={"color": "red"},
2727
)
2828

2929
expected = (

Diff for: components/dash-html-components/tests/utils.py

+4-8
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,14 @@
44
def assert_clean_console(TestClass):
55
def assert_no_console_errors(TestClass):
66
TestClass.assertEqual(
7-
TestClass.driver.execute_script(
8-
'return window.tests.console.error.length'
9-
),
10-
0
7+
TestClass.driver.execute_script("return window.tests.console.error.length"),
8+
0,
119
)
1210

1311
def assert_no_console_warnings(TestClass):
1412
TestClass.assertEqual(
15-
TestClass.driver.execute_script(
16-
'return window.tests.console.warn.length'
17-
),
18-
0
13+
TestClass.driver.execute_script("return window.tests.console.warn.length"),
14+
0,
1915
)
2016

2117
assert_no_console_warnings(TestClass)

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"private": true,
33
"license": "UNLICENSED",
44
"scripts": {
5-
"private::format.black": "black dash tests --exclude metadata_test.py",
5+
"private::format.black": "black dash tests components --exclude metadata_test.py",
66
"private::format.renderer": "cd dash/dash-renderer && npm run format",
77
"private::initialize.renderer": "cd dash/dash-renderer && npm ci",
88
"private::build.components": "python dash/development/update_components.py 'all'",

0 commit comments

Comments
 (0)