class documentation

class PytypeTest(test_base.UnitTest): (source)

View In Hierarchy

Integration test for pytype.

Class Method setUpClass Undocumented
Method assertHasErrors Undocumented
Method assertInferredPyiEquals Undocumented
Method assertOutputStateMatches Check that the output state matches expectations.
Method generate_pickled_simple_file Undocumented
Method setUp Undocumented
Method tearDown Undocumented
Method test_analyze_annotated Undocumented
Method test_bad_input_format Undocumented
Method test_bad_verify_pickle Undocumented
Method test_check Undocumented
Method test_check_infer_conflict Undocumented
Method test_check_infer_conflict2 Undocumented
Method test_check_main Undocumented
Method test_compiler_error Undocumented
Method test_complex Undocumented
Method test_constant_folding_error Undocumented
Method test_generate_and_use_builtins Test for --generate-builtins.
Method test_generate_builtins Undocumented
Method test_generate_builtins_input_conflict Undocumented
Method test_generate_builtins_pythonpath_conflict Undocumented
Method test_generate_pickled_ast Undocumented
Method test_generate_unverified_pickled_ast Undocumented
Method test_infer Undocumented
Method test_infer_compiler_error Undocumented
Method test_infer_complex Undocumented
Method test_infer_pytype_errors Undocumented
Method test_infer_to_file Undocumented
Method test_input_output_pair Undocumented
Method test_iso Undocumented
Method test_missing_input Undocumented
Method test_multi_line_statement_token_error Undocumented
Method test_multi_line_string_token_error Undocumented
Method test_multiple_input Undocumented
Method test_multiple_output Undocumented
Method test_no_analyze_annotated Undocumented
Method test_nonexistent_option Undocumented
Method test_parse_pyi Undocumented
Method test_pickle_bad_output Undocumented
Method test_pickle_no_output Undocumented
Method test_pickled_file_stableness Undocumented
Method test_pytree Test pytype on a real-world program.
Method test_pytype_errors Undocumented
Method test_pytype_errors_csv Undocumented
Method test_pytype_errors_no_report Undocumented
Method test_pytype_return_success Undocumented
Method test_return_type Undocumented
Method test_run_pytype Basic unit test (smoke test) for _run_pytype.
Method test_skip_file Undocumented
Method test_timeout Undocumented
Method test_usage_error Undocumented
Method test_use_builtins_and_import_map Test for --generate-builtins.
Constant INCLUDE Undocumented
Instance Variable errors_csv Undocumented
Instance Variable pytype_args Undocumented
Instance Variable returncode Undocumented
Instance Variable stderr Undocumented
Instance Variable stdout Undocumented
Instance Variable tmp_dir Undocumented
Method _check_types_and_errors Undocumented
Method _create_pytype_subprocess Undocumented
Method _data_path Undocumented
Method _infer_types_and_check_errors Undocumented
Method _make_file Undocumented
Method _make_py_file Undocumented
Method _parse_string A wrapper for parser.parse_string that inserts the python version.
Method _reset_pytype_args Undocumented
Method _run_pytype A single command-line call to the pytype binary.
Method _setup_checking Undocumented
Method _tmp_path Undocumented
@classmethod
def setUpClass(cls): (source)

Undocumented

def assertHasErrors(self, *expected_errors): (source)

Undocumented

def assertInferredPyiEquals(self, expected_pyi=None, filename=None): (source)

Undocumented

def assertOutputStateMatches(self, **has_output): (source)

Check that the output state matches expectations. If, for example, you expect the program to print something to stdout and nothing to stderr before exiting with an error code, you would write assertOutputStateMatches(stdout=True, stderr=False, returncode=True). Args: **has_output: Whether each output type should have output.

def generate_pickled_simple_file(self, pickle_name, verify_pickle=True): (source)

Undocumented

def setUp(self): (source)

Undocumented

def tearDown(self): (source)

Undocumented

def test_analyze_annotated(self): (source)

Undocumented

def test_bad_input_format(self): (source)

Undocumented

def test_bad_verify_pickle(self): (source)

Undocumented

def test_check(self): (source)

Undocumented

def test_check_infer_conflict(self): (source)

Undocumented

def test_check_infer_conflict2(self): (source)

Undocumented

def test_check_main(self): (source)

Undocumented

def test_compiler_error(self): (source)

Undocumented

def test_complex(self): (source)

Undocumented

def test_constant_folding_error(self): (source)

Undocumented

def test_generate_and_use_builtins(self): (source)

Test for --generate-builtins.

def test_generate_builtins(self): (source)

Undocumented

def test_generate_builtins_input_conflict(self): (source)

Undocumented

def test_generate_builtins_pythonpath_conflict(self): (source)

Undocumented

def test_generate_pickled_ast(self): (source)

Undocumented

def test_generate_unverified_pickled_ast(self): (source)

Undocumented

def test_infer(self): (source)

Undocumented

def test_infer_compiler_error(self): (source)

Undocumented

def test_infer_complex(self): (source)

Undocumented

def test_infer_pytype_errors(self): (source)

Undocumented

def test_infer_to_file(self): (source)

Undocumented

def test_input_output_pair(self): (source)

Undocumented

def test_iso(self): (source)

Undocumented

def test_missing_input(self): (source)

Undocumented

def test_multi_line_statement_token_error(self): (source)

Undocumented

def test_multi_line_string_token_error(self): (source)

Undocumented

def test_multiple_input(self): (source)

Undocumented

def test_multiple_output(self): (source)

Undocumented

def test_no_analyze_annotated(self): (source)

Undocumented

def test_nonexistent_option(self): (source)

Undocumented

def test_parse_pyi(self): (source)

Undocumented

def test_pickle_bad_output(self): (source)

Undocumented

def test_pickle_no_output(self): (source)

Undocumented

@test_base.skip('flaky; see b/195678773')
def test_pickled_file_stableness(self): (source)

Undocumented

def test_pytree(self): (source)

Test pytype on a real-world program.

def test_pytype_errors(self): (source)

Undocumented

def test_pytype_errors_csv(self): (source)

Undocumented

def test_pytype_errors_no_report(self): (source)

Undocumented

def test_pytype_return_success(self): (source)

Undocumented

def test_return_type(self): (source)

Undocumented

def test_run_pytype(self): (source)

Basic unit test (smoke test) for _run_pytype.

def test_skip_file(self): (source)

Undocumented

def test_timeout(self): (source)

Undocumented

def test_usage_error(self): (source)

Undocumented

def test_use_builtins_and_import_map(self): (source)

Test for --generate-builtins.

Undocumented

Value
object()
errors_csv = (source)

Undocumented

pytype_args = (source)

Undocumented

returncode = (source)

Undocumented

Undocumented

Undocumented

Undocumented

def _check_types_and_errors(self, filename, expected_errors): (source)

Undocumented

def _create_pytype_subprocess(self, pytype_args_dict): (source)

Undocumented

def _data_path(self, filename): (source)

Undocumented

def _infer_types_and_check_errors(self, filename, expected_errors): (source)

Undocumented

def _make_file(self, contents, extension): (source)

Undocumented

def _make_py_file(self, contents): (source)

Undocumented

def _parse_string(self, string): (source)

A wrapper for parser.parse_string that inserts the python version.

def _reset_pytype_args(self): (source)

Undocumented

def _run_pytype(self, pytype_args_dict): (source)

A single command-line call to the pytype binary. Typically you'll want to use _CheckTypesAndErrors or _InferTypesAndCheckErrors, which will set up the command-line arguments properly and check that the errors file is in the right state after the call. (The errors check is bundled in to avoid the user forgetting to call assertHasErrors() with no arguments when expecting no errors.) Args: pytype_args_dict: A dictionary of the arguments to pass to pytype, minus the binary name. For example, to run pytype simple.py --output=- the arguments should be {"simple.py": self.INCLUDE, "--output": "-"}

def _setup_checking(self, filename): (source)

Undocumented

def _tmp_path(self, filename): (source)

Undocumented