Skip to content

Commit 92caea7

Browse files
committed
0.4.2 - fix the test of the docstring
Fix: The comparison of the docstring may fail because different versions of `dash` may produce docstrings in different order. Make the docstring comparison more robust.
1 parent b1a0634 commit 92caea7

File tree

3 files changed

+26
-23
lines changed

3 files changed

+26
-23
lines changed

Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#### :wrench: Fix
1414

1515
1. Fix: Improve the sanitization of the input data. Previously, the sanitization does not work correctly if the `data` is specified by `None`.
16+
2. Fix: The comparison of the docstring may fail because different versions of `dash` may produce docstrings in different order. Make the docstring comparison more robust.
1617

1718
#### :floppy_disk: Change
1819

dash_json_grid/__init__.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,15 @@ class DashJsonGrid(_DashJsonGrid, _MixinDataRoute, _MixinFile):
142142
143143
`loading_state` is a dict with keys:
144144
145-
- component_name (string; optional):
146-
Holds the name of the component that is loading.
147-
148145
- is_loading (boolean; optional):
149146
Determines if the component is loading or not.
150147
151148
- prop_name (string; optional):
152149
Holds which property is loading.
153150
151+
- component_name (string; optional):
152+
Holds the name of the component that is loading.
153+
154154
- search_text (string; optional):
155155
The text that needs to be searched in the JSON data.
156156
@@ -180,42 +180,42 @@ class DashJsonGrid(_DashJsonGrid, _MixinDataRoute, _MixinFile):
180180
- bgColor (string; optional):
181181
Background color of the whole grid view.
182182
183-
- booleanColor (string; optional):
184-
Text color of boolean variables.
185-
186183
- borderColor (string; optional):
187184
Border color of the whole grid view.
188185
189186
- cellBorderColor (string; optional):
190187
Background color of table cells.
191188
192-
- indexColor (string; optional):
193-
Text color of sequence indicies.
194-
195189
- keyColor (string; optional):
196190
Text color of mapping keys.
197191
192+
- indexColor (string; optional):
193+
Text color of sequence indicies.
194+
198195
- numberColor (string; optional):
199196
Text color of numeric values.
200197
201-
- objectColor (string; optional):
202-
Text color of unrecognized objects.
203-
204-
- searchHighlightBgColor (string; optional):
205-
Background color of the part highlighted by the search.
206-
207-
- selectHighlightBgColor (string; optional):
208-
Background color when this part is highlighted by the
209-
selection.
198+
- booleanColor (string; optional):
199+
Text color of boolean variables.
210200
211201
- stringColor (string; optional):
212202
Text color of strings.
213203
204+
- objectColor (string; optional):
205+
Text color of unrecognized objects.
206+
214207
- tableHeaderBgColor (string; optional):
215208
Background color of the table header.
216209
217210
- tableIconColor (string; optional):
218-
Text color of the icon in the table header."""
211+
Text color of the icon in the table header.
212+
213+
- selectHighlightBgColor (string; optional):
214+
Background color when this part is highlighted by the
215+
selection.
216+
217+
- searchHighlightBgColor (string; optional):
218+
Background color of the part highlighted by the search."""
219219

220220

221221
for _component in __all__:

tests/utils.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@
2020

2121
try:
2222
from typing import Sequence, Mapping
23+
from typing import FrozenSet
2324
except ImportError:
2425
from collections.abc import Sequence, Mapping
26+
from builtins import frozenset as FrozenSet
2527

2628

2729
from dash.testing.composite import DashComposite
@@ -82,7 +84,7 @@ def is_mapping_with_keys(val: Any, keys: Sequence[Any]) -> bool:
8284
return set(val.keys()) == set(keys)
8385

8486

85-
def docstring_space_remove(obj: Any) -> str:
87+
def docstring_space_remove(obj: Any) -> FrozenSet[str]:
8688
"""Get the docstring of an object, with the leading/trailing spaces removed.
8789
8890
Arguments
@@ -98,10 +100,10 @@ def docstring_space_remove(obj: Any) -> str:
98100
"""
99101
doc = getattr(obj, "__doc__", None)
100102
if not doc:
101-
return ""
103+
return frozenset(("",))
102104
if not isinstance(doc, str):
103-
return ""
104-
return "".join(line.strip() for line in doc.splitlines())
105+
return frozenset(("",))
106+
return frozenset(line.strip() for line in doc.splitlines())
105107

106108

107109
class attribute_value_neq:

0 commit comments

Comments
 (0)