module documentation
(source)

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 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 testcase​_pyversion Undocumented
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, b, fmt='{} != {}'): (source)

Undocumented

Parameters
a:objectUndocumented
b:objectUndocumented
fmt:strUndocumented
def assert_module_equivalence(name, expected, actual): (source)

Undocumented

Parameters
name:strUndocumented
expected:Iterable[str]Undocumented
actual:Iterable[str]Undocumented
def assert_string_arrays_equal(expected, actual, msg): (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.

Parameters
expected:List[str]Undocumented
actual:List[str]Undocumented
msg:strUndocumented
def assert_target_equivalence(name, expected, actual): (source)
Compare actual and expected targets (order sensitive).
Parameters
name:strUndocumented
expected:List[str]Undocumented
actual:List[str]Undocumented
def assert_type(typ, value): (source)

Undocumented

Parameters
typ:typeUndocumented
value:objectUndocumented
def check_test_output_files(testcase, step, strip_prefix=''): (source)

Undocumented

Parameters
testcase:DataDrivenTestCaseUndocumented
step:intUndocumented
strip​_prefix:strUndocumented
def clean_up(a): (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.

Parameters
a:List[str]Undocumented
Returns
List[str]Undocumented
def good_repr(obj): (source)

Undocumented

Parameters
obj:objectUndocumented
Returns
strUndocumented
@contextlib.contextmanager
def local_sys_path_set(): (source)

Temporary insert current directory into sys.path.

This can be used by test cases that do runtime imports, for example by the stubgen tests.

Returns
Iterator[None]Undocumented
def normalize_error_messages(messages): (source)
Translate an array of error messages to use / as path separator.
Parameters
messages:List[str]Undocumented
Returns
List[str]Undocumented
def normalize_file_output(content, current_abs_path): (source)
Normalize file output for comparison.
Parameters
content:List[str]Undocumented
current​_abs​_path:strUndocumented
Returns
List[str]Undocumented
def num_skipped_prefix_lines(a1, a2): (source)

Undocumented

Parameters
a1:List[str]Undocumented
a2:List[str]Undocumented
Returns
intUndocumented
def num_skipped_suffix_lines(a1, a2): (source)

Undocumented

Parameters
a1:List[str]Undocumented
a2:List[str]Undocumented
Returns
intUndocumented
def parse_options(program_text, testcase, incremental_step): (source)
Parse comments like '# flags: --foo' in a test case.
Parameters
program​_text:strUndocumented
testcase:DataDrivenTestCaseUndocumented
incremental​_step:intUndocumented
Returns
OptionsUndocumented
def perform_file_operations(operations): (source)

Undocumented

Parameters
operations:List[Union[UpdateFile, DeleteFile]]Undocumented
def retry_on_error(func, max_wait=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.

Parameters
func:Callable[[], Any]Undocumented
max​_wait:floatUndocumented
def run_mypy(args): (source)

Undocumented

Parameters
args:List[str]Undocumented
def show_align_message(s1, s2): (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.

Parameters
s1:strUndocumented
s2:strUndocumented
def split_lines(*streams): (source)
Returns a single list of string lines from the byte streams in args.
Parameters
*streams:bytesUndocumented
Returns
List[str]Undocumented
def testcase_pyversion(path, testcase_name): (source)

Undocumented

Parameters
path:strUndocumented
testcase​_name:strUndocumented
Returns
Tuple[int, int]Undocumented
def testfile_pyversion(path): (source)

Undocumented

Parameters
path:strUndocumented
Returns
Tuple[int, int]Undocumented
def typename(t): (source)

Undocumented

Parameters
t:typeUndocumented
Returns
strUndocumented
def update_testcase_output(testcase, output): (source)

Undocumented

Parameters
testcase:DataDrivenTestCaseUndocumented
output:List[str]Undocumented
def write_and_fudge_mtime(content, target_path): (source)

Undocumented

Parameters
content:strUndocumented
target​_path:strUndocumented
MIN_LINE_LENGTH_FOR_ALIGNMENT: int = (source)

Undocumented

Value
5