-
Notifications
You must be signed in to change notification settings - Fork 815
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add meta test for code editor params
- Loading branch information
1 parent
d6db022
commit 4cb6244
Showing
1 changed file
with
18 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import inspect | ||
|
||
from textual.widgets import TextArea | ||
|
||
|
||
def test_code_editor_parameters_kept_up_to_date(): | ||
"""Meta test to ensure the `TextArea.code_editor` convenience constructor | ||
is kept up to date with changes to the `TextArea.__init__` parameters. | ||
""" | ||
text_area_params = inspect.signature(TextArea.__init__).parameters | ||
code_editor_params = inspect.signature(TextArea.code_editor).parameters | ||
expected_diffs = ["theme", "soft_wrap", "tab_behavior", "show_line_numbers"] | ||
for param in text_area_params: | ||
if param == "self": | ||
continue | ||
assert param in code_editor_params | ||
if param not in expected_diffs: | ||
assert code_editor_params[param] == text_area_params[param] |