module documentation

Undocumented

Function test_aliasing Undocumented
Function test_aliasing_recursion Undocumented
Function test_all_recognition The value assigned to __all__ is parsed to Module.dunder_all.
Function test_all_recognition_complex The value assigned to __all__ is correctly inferred when it's built from binary operation '+' or augmented assigments '+='.
Function test_class_decos_and_bases Undocumented
Function test_class_docstring Undocumented
Function test_class_is_abstract Undocumented
Function test_class_with_base_from_module Undocumented
Function test_class_with_base_from_module_alt Undocumented
Function test_docformat_recognition The value assigned to __docformat__ is parsed to Module.docformat.
Function test_docformat_warn_empty Undocumented
Function test_docformat_warn_not_str Undocumented
Function test_docformat_warn_not_str2 Undocumented
Function test_function_async Undocumented
Function test_function_badsig When a function has an invalid signature, an error is logged and the empty signature is returned.
Function test_function_name_dulpicate_module It's possible that a function or class name is the same as a module's. The builder should not crash.
Function test_function_signature A round trip from source to inspect.Signature and back produces the original text.
Function test_function_signature_posonly Undocumented
Function test_function_simple Undocumented
Function test_inherited_members Test for the inherited_members property.
Function test_no_docstring Undocumented
Function test_relative_import_in_package Relative imports in a package must be resolved by going up one level less, since we don't count "__init__.py" as a level.
Function test_relative_import_in_package_star_import Relative imports in a package must be resolved by going up one level less, since we don't count "__init__.py" as a level.
Function test_relative_import_past_top A warning is logged when a relative import goes beyond the top-level package.
Function test_type_alias Undocumented
Variable posonlyargs Undocumented
Variable typecomment Undocumented
@getbuilder_param
def test_aliasing(getbuilder): (source)

Undocumented

Parameters
getbuilder:Callable[[], astbuilder.Builder]Undocumented
@mod_from_text_param
def test_aliasing_recursion(mod_from_text): (source)

Undocumented

Parameters
mod_from_text:ModFromTextFunctionUndocumented
@mod_from_text_param
def test_all_recognition(mod_from_text): (source)

The value assigned to __all__ is parsed to Module.dunder_all.

Parameters
mod_from_text:ModFromTextFunctionUndocumented
@getbuilder_param
@pytest.mark.parametrize(['top_src_last_line'], [('__all__ = [\'f\'] + mod_all'), ('__all__ = [\'f\']; __all__ += mod_all'), ('__all__ = list([\'f\'] + mod_all)'), ('__all__ = [\'f\']; __all__.extend(mod_all)'), ('__all__ = [\'f\']; __all__.append(mod_all[0])'), ('__all__ = [\'f\']; __all__.extend(mod_all + [\'123\']); __all__.remove(\'123\')')])
def test_all_recognition_complex(getbuilder, top_src_last_line): (source)

The value assigned to __all__ is correctly inferred when it's built from binary operation '+' or augmented assigments '+='.

As well as understands __all__.extend(), __all__.remove() and __all__.append().

Parameters
getbuilder:Callable[[], astbuilder.Builder]Undocumented
top_src_last_line:strUndocumented
@mod_from_text_param
def test_class_decos_and_bases(mod_from_text, caplog): (source)

Undocumented

Parameters
mod_from_text:ModFromTextFunctionUndocumented
caplog:CapLogUndocumented
@getbuilder_param
def test_class_docstring(getbuilder): (source)

Undocumented

Parameters
getbuilder:Callable[[], astbuilder.Builder]Undocumented
@mod_from_text_param
def test_class_is_abstract(mod_from_text, caplog): (source)

Undocumented

Parameters
mod_from_text:ModFromTextFunctionUndocumented
caplog:CapLogUndocumented
@mod_from_text_param
def test_class_with_base_from_module(mod_from_text): (source)

Undocumented

Parameters
mod_from_text:ModFromTextFunctionUndocumented
@mod_from_text_param
def test_class_with_base_from_module_alt(mod_from_text): (source)

Undocumented

Parameters
mod_from_text:ModFromTextFunctionUndocumented
@mod_from_text_param
def test_docformat_recognition(mod_from_text): (source)

The value assigned to __docformat__ is parsed to Module.docformat.

Parameters
mod_from_text:ModFromTextFunctionUndocumented
@mod_from_text_param
def test_docformat_warn_empty(mod_from_text, caplog): (source)

Undocumented

Parameters
mod_from_text:ModFromTextFunctionUndocumented
caplog:CapLogUndocumented
@mod_from_text_param
def test_docformat_warn_not_str(mod_from_text, caplog): (source)

Undocumented

Parameters
mod_from_text:ModFromTextFunctionUndocumented
caplog:CapLogUndocumented
@mod_from_text_param
def test_docformat_warn_not_str2(mod_from_text, caplog): (source)

Undocumented

Parameters
mod_from_text:ModFromTextFunctionUndocumented
caplog:CapLogUndocumented
@mod_from_text_param
def test_function_async(mod_from_text): (source)

Undocumented

Parameters
mod_from_text:ModFromTextFunctionUndocumented
@pytest.mark.parametrize('signature', ('(a, a)'))
@mod_from_text_param
def test_function_badsig(signature, mod_from_text, caplog): (source)

When a function has an invalid signature, an error is logged and the empty signature is returned.

Note that most bad signatures lead to a SyntaxError, which we cannot recover from. This test checks what happens if the AST can be produced but inspect.Signature() rejects the parsed parameters.

Parameters
signature:strUndocumented
mod_from_text:ModFromTextFunctionUndocumented
caplog:CapLogUndocumented
@getbuilder_param
def test_function_name_dulpicate_module(getbuilder): (source)

It's possible that a function or class name is the same as a module's. The builder should not crash.

Parameters
getbuilder:Callable[[], astbuilder.Builder]Undocumented
@pytest.mark.parametrize('signature', ('()', '(*, a, b=None)', '(*, a=(), b)', '(a, b=3, *c, **kw)', '(f=True)', '(x=0.1, y=-2)', '(s=\'theory\', t="con\'text")'))
@mod_from_text_param
def test_function_signature(signature, mod_from_text): (source)

A round trip from source to inspect.Signature and back produces the original text.

Parameters
signature:strUndocumented
mod_from_text:ModFromTextFunctionUndocumented
@posonlyargs
@pytest.mark.parametrize('signature', ('(x, y, /)', '(x, y=0, /)', '(x, y, /, z, w)', '(x, y, /, z, w=42)', '(x, y, /, z=0, w=0)', '(x, y=3, /, z=5, w=7)', '(x, /, *v, a=1, b=2)', '(x, /, *, a=1, b=2, **kwargs)'))
@mod_from_text_param
def test_function_signature_posonly(signature, mod_from_text): (source)

Undocumented

Parameters
signature:strUndocumented
mod_from_text:ModFromTextFunctionUndocumented
@mod_from_text_param
def test_function_simple(mod_from_text): (source)

Undocumented

Parameters
mod_from_text:ModFromTextFunctionUndocumented
@getbuilder_param
def test_inherited_members(getbuilder): (source)

Test for the inherited_members property.

Parameters
getbuilder:Callable[[], astbuilder.Builder]Undocumented
@mod_from_text_param
def test_no_docstring(mod_from_text): (source)

Undocumented

Parameters
mod_from_text:ModFromTextFunctionUndocumented
@getbuilder_param
def test_relative_import_in_package(getbuilder): (source)

Relative imports in a package must be resolved by going up one level less, since we don't count "__init__.py" as a level.

Hierarchy:

top: def f
 - pkg: imports f and g
    - mod: def g
Parameters
getbuilder:Callable[[], astbuilder.Builder]Undocumented
@getbuilder_param
def test_relative_import_in_package_star_import(getbuilder): (source)

Relative imports in a package must be resolved by going up one level less, since we don't count "__init__.py" as a level.

Hierarchy:

top: class f
 - pkg: imports f and * from mod
    - mod: class g, e, h, j
Parameters
getbuilder:Callable[[], astbuilder.Builder]Undocumented
@getbuilder_param
@pytest.mark.parametrize('level', (1, 2, 3, 4))
def test_relative_import_past_top(getbuilder, level, caplog): (source)

A warning is logged when a relative import goes beyond the top-level package.

Parameters
getbuilder:Callable[[], astbuilder.Builder]Undocumented
level:intUndocumented
caplog:CapLogUndocumented
@mod_from_text_param
def test_type_alias(mod_from_text, caplog): (source)

Undocumented

Parameters
mod_from_text:ModFromTextFunctionUndocumented
caplog:CapLogUndocumented
posonlyargs = (source)

Undocumented

typecomment = (source)

Undocumented