module documentation

Undocumented

Function assert_equal Undocumented
Function assert_module_equivalence Undocumented
Function assert_string_arrays_equal Assert that two string arrays are equal.
Function assert_target_equivalence Compare actual and expected targets (order sensitive).
Function assert_type Undocumented
Function check_test_output_files Undocumented
Function clean_up Remove common directory prefix from all strings in a.
Function find_test_files Undocumented
Function good_repr Undocumented
Function local_sys_path_set Temporary insert current directory into sys.path.
Function normalize_error_messages Translate an array of error messages to use / as path separator.
Function normalize_file_output Normalize file output for comparison.
Function num_skipped_prefix_lines Undocumented
Function num_skipped_suffix_lines Undocumented
Function parse_options Parse comments like '# flags: --foo' in a test case.
Function perform_file_operations Undocumented
Function retry_on_error Retry callback with exponential backoff when it raises OSError.
Function run_mypy Undocumented
Function show_align_message Align s1 and s2 so that the their first difference is highlighted.
Function split_lines Returns a single list of string lines from the byte streams in args.
Function testfile_pyversion Undocumented
Function typename Undocumented
Function update_testcase_output Undocumented
Function write_and_fudge_mtime Undocumented
Constant MIN_LINE_LENGTH_FOR_ALIGNMENT Undocumented
def assert_equal(a: object, b: object, fmt: str = '{} != {}'): (source)

Undocumented

def assert_module_equivalence(name: str, expected: Iterable[str], actual: Iterable[str]): (source)

Undocumented

def assert_string_arrays_equal(expected: list[str], actual: list[str], msg: str): (source)

Assert that two string arrays are equal. We consider "can't" and "cannot" equivalent, by replacing the former with the latter before comparing. Display any differences in a human-readable form.

def assert_target_equivalence(name: str, expected: list[str], actual: list[str]): (source)

Compare actual and expected targets (order sensitive).

def assert_type(typ: type, value: object): (source)

Undocumented

def check_test_output_files(testcase: DataDrivenTestCase, step: int, strip_prefix: str = ''): (source)

Undocumented

def clean_up(a: list[str]) -> list[str]: (source)

Remove common directory prefix from all strings in a. This uses a naive string replace; it seems to work well enough. Also remove trailing carriage returns.

def find_test_files(pattern: str, exclude: list[str]|None = None) -> list[str]: (source)

Undocumented

def good_repr(obj: object) -> str: (source)

Undocumented

Temporary insert current directory into sys.path. This can be used by test cases that do runtime imports, for example by the stubgen tests.

def normalize_error_messages(messages: list[str]) -> list[str]: (source)

Translate an array of error messages to use / as path separator.

def normalize_file_output(content: list[str], current_abs_path: str) -> list[str]: (source)

Normalize file output for comparison.

def num_skipped_prefix_lines(a1: list[str], a2: list[str]) -> int: (source)

Undocumented

def num_skipped_suffix_lines(a1: list[str], a2: list[str]) -> int: (source)

Undocumented

def parse_options(program_text: str, testcase: DataDrivenTestCase, incremental_step: int) -> Options: (source)

Parse comments like '# flags: --foo' in a test case.

def perform_file_operations(operations: list[UpdateFile|DeleteFile]): (source)

Undocumented

def retry_on_error(func: Callable[[], Any], max_wait: float = 1.0): (source)

Retry callback with exponential backoff when it raises OSError. If the function still generates an error after max_wait seconds, propagate the exception. This can be effective against random file system operation failures on Windows.

def run_mypy(args: list[str]): (source)

Undocumented

def show_align_message(s1: str, s2: str): (source)

Align s1 and s2 so that the their first difference is highlighted. For example, if s1 is 'foobar' and s2 is 'fobar', display the following lines: E: foobar A: fobar ^ If s1 and s2 are long, only display a fragment of the strings around the first difference. If s1 is very short, do nothing.

def split_lines(*streams: bytes) -> list[str]: (source)

Returns a single list of string lines from the byte streams in args.

def testfile_pyversion(path: str) -> tuple[int, int]: (source)

Undocumented

def typename(t: type) -> str: (source)

Undocumented

def update_testcase_output(testcase: DataDrivenTestCase, output: list[str]): (source)

Undocumented

def write_and_fudge_mtime(content: str, target_path: str): (source)

Undocumented

MIN_LINE_LENGTH_FOR_ALIGNMENT: int = (source)

Undocumented

Value
5