Skip to content

Commit 1a54867

Browse files
committed
Fix related test cases
1 parent 5e18fba commit 1a54867

File tree

3 files changed

+14
-45
lines changed

3 files changed

+14
-45
lines changed

tests/unit/development/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def has_trailing_space(s):
3939
"",
4040
"- optionalElement (dash component; optional)",
4141
"",
42-
"- optionalEnum (a value equal to: 'News'," " 'Photos'; optional)",
42+
"- optionalEnum (a value equal to: 'News', 'Photos'; optional)",
4343
"",
4444
"- optionalNode (a list of or a singular dash component, string or number; optional)",
4545
"",
@@ -55,6 +55,8 @@ def has_trailing_space(s):
5555
"",
5656
" - color (string; optional)",
5757
"",
58+
" - fontSize (number; optional)",
59+
"",
5860
" - figure (dict; optional):",
5961
" Figure is a plotly graph object.",
6062
"",
@@ -66,14 +68,14 @@ def has_trailing_space(s):
6668
" - layout (dict; optional):",
6769
" layout describes the rest of the figure.",
6870
"",
69-
" - fontSize (number; optional)",
70-
"",
7171
"- optionalObjectWithShapeAndNestedDescription (dict; optional)",
7272
"",
7373
" `optionalObjectWithShapeAndNestedDescription` is a dict with keys:",
7474
"",
7575
" - color (string; optional)",
7676
"",
77+
" - fontSize (number; optional)",
78+
"",
7779
" - figure (dict; optional):",
7880
" Figure is a plotly graph object.",
7981
"",
@@ -85,8 +87,6 @@ def has_trailing_space(s):
8587
" - layout (dict; optional):",
8688
" layout describes the rest of the figure.",
8789
"",
88-
" - fontSize (number; optional)",
89-
"",
9090
"- optionalString (string; default 'hello world')",
9191
"",
9292
"- optionalUnion (string | number; optional)",

tests/unit/development/metadata_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ class Table(Component):
5151
5252
- color (string; optional)
5353
54+
- fontSize (number; optional)
55+
5456
- figure (dict; optional):
5557
Figure is a plotly graph object.
5658
@@ -62,14 +64,14 @@ class Table(Component):
6264
- layout (dict; optional):
6365
layout describes the rest of the figure.
6466
65-
- fontSize (number; optional)
66-
6767
- optionalObjectWithShapeAndNestedDescription (dict; optional)
6868
6969
`optionalObjectWithShapeAndNestedDescription` is a dict with keys:
7070
7171
- color (string; optional)
7272
73+
- fontSize (number; optional)
74+
7375
- figure (dict; optional):
7476
Figure is a plotly graph object.
7577
@@ -81,8 +83,6 @@ class Table(Component):
8183
- layout (dict; optional):
8284
layout describes the rest of the figure.
8385
84-
- fontSize (number; optional)
85-
8686
- optionalString (string; default 'hello world')
8787
8888
- optionalUnion (string | number; optional)"""

tests/unit/development/test_metadata_conversions.py

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -10,62 +10,32 @@
1010

1111
expected_arg_strings = OrderedDict(
1212
[
13-
["children", "a list of or a singular dash component, string or number"],
1413
["optionalArray", "list"],
1514
["optionalBool", "boolean"],
1615
["optionalFunc", ""],
1716
["optionalNumber", "number"],
1817
["optionalObject", "dict"],
1918
["optionalString", "string"],
2019
["optionalSymbol", ""],
21-
["optionalElement", "dash component"],
2220
["optionalNode", "a list of or a singular dash component, string or number"],
21+
["optionalElement", "dash component"],
2322
["optionalMessage", ""],
2423
["optionalEnum", "a value equal to: 'News', 'Photos'"],
2524
["optionalUnion", "string | number"],
2625
["optionalArrayOf", "list of numbers"],
2726
["optionalObjectOf", "dict with strings as keys and values of type number"],
2827
[
2928
"optionalObjectWithExactAndNestedDescription",
30-
"\n".join(
31-
[
32-
"dict with keys:\n",
33-
" - color (string; optional)\n",
34-
" - figure (dict; optional):",
35-
" Figure is a plotly graph object.\n",
36-
" `figure` is a dict with keys:\n",
37-
# noqa: E501
38-
" - data (list of dicts; optional):",
39-
" data is a collection of traces.\n",
40-
" - layout (dict; optional):",
41-
" layout describes the rest of the figure.\n",
42-
# noqa: E501
43-
" - fontSize (number; optional)",
44-
]
45-
),
29+
"dict with keys:\n\n - color (string; optional)\n\n - fontSize (number; optional)\n\n - figure (dict; optional):\n Figure is a plotly graph object.\n\n `figure` is a dict with keys:\n\n - data (list of dicts; optional):\n data is a collection of traces.\n\n - layout (dict; optional):\n layout describes the rest of the figure.",
4630
],
4731
[
4832
"optionalObjectWithShapeAndNestedDescription",
49-
"\n".join(
50-
[
51-
"dict with keys:\n",
52-
" - color (string; optional)\n",
53-
" - figure (dict; optional):",
54-
" Figure is a plotly graph object.\n",
55-
" `figure` is a dict with keys:\n",
56-
# noqa: E501
57-
" - data (list of dicts; optional):",
58-
" data is a collection of traces.\n",
59-
" - layout (dict; optional):",
60-
" layout describes the rest of the figure.\n",
61-
# noqa: E501
62-
" - fontSize (number; optional)",
63-
],
64-
),
33+
"dict with keys:\n\n - color (string; optional)\n\n - fontSize (number; optional)\n\n - figure (dict; optional):\n Figure is a plotly graph object.\n\n `figure` is a dict with keys:\n\n - data (list of dicts; optional):\n data is a collection of traces.\n\n - layout (dict; optional):\n layout describes the rest of the figure.",
6534
],
6635
["optionalAny", "boolean | number | string | dict | list"],
6736
["customProp", ""],
6837
["customArrayProp", "list"],
38+
["children", "a list of or a singular dash component, string or number"],
6939
["data-*", "string"],
7040
["aria-*", "string"],
7141
["in", "string"],
@@ -80,12 +50,11 @@ def test_docstring(load_test_metadata_json):
8050
load_test_metadata_json["props"],
8151
load_test_metadata_json["description"],
8252
)
83-
prohibit_events(load_test_metadata_json["props"]),
53+
(prohibit_events(load_test_metadata_json["props"]),)
8454
assert not list(unified_diff(expected_table_component_doc, docstring.splitlines()))
8555

8656

8757
def test_docgen_to_python_args(load_test_metadata_json):
8858
props = load_test_metadata_json["props"]
89-
9059
for prop_name, prop in list(props.items()):
9160
assert js_to_py_type(prop["type"]) == expected_arg_strings[prop_name]

0 commit comments

Comments
 (0)