File: test_code_editor.py

package info (click to toggle)
textual 2.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 55,056 kB
  • sloc: python: 85,423; lisp: 1,669; makefile: 101
file content (18 lines) | stat: -rw-r--r-- 734 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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]