Skip to content

Commit

Permalink
add meta test for code editor params
Browse files Browse the repository at this point in the history
  • Loading branch information
TomJGooding committed Feb 18, 2024
1 parent d6db022 commit 4cb6244
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/text_area/test_code_editor.py
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]

0 comments on commit 4cb6244

Please sign in to comment.