Example #1
0
def test_public_simple_enclosed_types__filter_match(cpp_class):
    simple_enclosed_types = [
        m.name for m in public_simple_enclosed_types(
            cpp_class, InsertionFilter(members=".*Typedef"))
    ]
    assert sorted(simple_enclosed_types) == sorted(
        ["PublicTypedef", "ProtectedTypedef"])
Example #2
0
def test_public_properties__filter_match(objc_class):
    result = [
        m.name
        for m in public_properties(objc_class, InsertionFilter(
            members="Public"))
    ]
    assert result == ["PublicProperty"]
Example #3
0
def test_public_variables__filter_match(cpp_class):
    result = [
        m.name
        for m in public_variables(cpp_class, InsertionFilter(
            members=".*Var.*"))
    ]
    assert result == ["PublicVariable"]
Example #4
0
def test_public_simple_enclosed_types__no_filter(cpp_class):
    simple_enclosed_types = [
        m.name
        for m in public_simple_enclosed_types(cpp_class, InsertionFilter())
    ]
    assert sorted(simple_enclosed_types) == sorted(
        ["PublicEnum", "PublicTypedef", "ProtectedEnum", "ProtectedTypedef"])
Example #5
0
def test_public_simple_enclosed_types__filter_match(objc_class):
    result = [
        m.name for m in public_simple_enclosed_types(
            objc_class, InsertionFilter(members=".*Enum"))
    ]
    assert sorted(result) == sorted([
        "PublicEnum",
        "ProtectedEnum",
        "PrivateEnum",
    ])
Example #6
0
def test_public_simple_enclosed_types__no_filter(objc_class):
    result = [
        m.name
        for m in public_simple_enclosed_types(objc_class, InsertionFilter())
    ]
    assert sorted(result) == sorted([
        "PublicEnum", "ProtectedEnum", "PrivateEnum", "PublicClass",
        "ProtectedClass", "PrivateClass", "PublicProtocol",
        "ProtectedProtocol", "PrivateProtocol"
    ])
def test_insertion_filter__compound__filter_members(cpp_class):
    insertion_filter = InsertionFilter(members={"kind": "variable"})

    member_names = [
        member.name for member in insertion_filter.members(cpp_class)
    ]
    assert sorted(member_names) == sorted([
        "PublicVariable",
        "ProtectedVariable",
        "PrivateVariable",
    ])
def test_insertion_filer__member__exceptions__filter_name(api_reference):
    member = api_reference.find(
        "asciidoxy::traffic::TrafficEvent::CalculateDelay")
    assert member is not None

    insertion_filter = InsertionFilter(exceptions="NONE")

    exception_names = [
        exception.type.name
        for exception in insertion_filter.exceptions(member)
    ]
    assert sorted(exception_names) == sorted([])
def test_insertion_filter__compound__no_filters(cpp_class):
    insertion_filter = InsertionFilter()

    member_names = [
        member.name for member in insertion_filter.members(cpp_class)
    ]
    assert sorted(member_names) == sorted([
        "PublicVariable", "PublicEnum", "PublicClass", "PublicTypedef",
        "PublicStruct", "PublicTrash", "PublicEnumvalue", "MyClass", "MyClass",
        "MyClass", "MyClass", "MyClass", "MyClass", "MyClass", "operator++",
        "PublicMethod", "PublicStaticMethod", "ProtectedVariable",
        "ProtectedEnum", "ProtectedClass", "ProtectedTypedef",
        "ProtectedStruct", "ProtectedTrash", "ProtectedEnumvalue", "MyClass",
        "operator++", "ProtectedMethod", "ProtectedStaticMethod",
        "PrivateVariable", "PrivateEnum", "PrivateClass", "PrivateTypedef",
        "PrivateStruct", "PrivateTrash", "PrivateEnumvalue", "MyClass",
        "operator++", "PrivateMethod", "PrivateStaticMethod", "operator=",
        "operator=", "operator=", "operator=", "operator=", "operator=",
        "~MyClass", "~MyClass", "~MyClass"
    ])
Example #10
0
def test_public_constants__filter_match(helper):
    helper.insert_filter = InsertionFilter(members="Public")
    result = [m.name for m in helper.constants(prot="public")]
    assert result == ["PublicConstant"]
Example #11
0
def test_public_methods__filter_no_match(helper):
    helper.insert_filter = InsertionFilter(members="PublicThing")
    result = [m.name for m in helper.methods(prot="public")]
    assert len(result) == 0
Example #12
0
def test_public_destructors__filter_no_match(helper):
    helper.insert_filter = InsertionFilter(members="OtherClass")
    result = list(helper.destructors(prot="public"))
    assert len(result) == 0
Example #13
0
def helper(empty_generating_api, cpp_class):
    return CppTemplateHelper(empty_generating_api, cpp_class,
                             InsertionFilter())
Example #14
0
def test_public_variables__filter_no_match(python_class):
    result = list(m.name for m in public_variables(python_class, InsertionFilter(members="NONE")))
    assert not result
Example #15
0
def test_public_variables__no_filter(python_class):
    result = list(m.name for m in public_variables(python_class, InsertionFilter()))
    assert sorted(result) == sorted(["public_variable"])
Example #16
0
def test_public_enclosed_types__filter_match(python_class):
    result = list(
        m.name for m in public_enclosed_types(python_class, InsertionFilter(inner_classes="ALL")))
    assert sorted(result) == sorted(["NestedClass"])
Example #17
0
def test_public_enclosed_types__filter_no_match(python_class):
    result = list(
        m.name for m in public_enclosed_types(python_class, InsertionFilter(inner_classes="NONE")))
    assert not result
def helper(empty_generating_api, objc_class):
    return ObjcTemplateHelper(empty_generating_api, objc_class,
                              InsertionFilter())
Example #19
0
def test_public_variables__filter_match(python_class):
    result = list(m.name for m in public_variables(python_class, InsertionFilter(members="ALL")))
    assert sorted(result) == sorted(["public_variable"])
def test_public_class_methods__filter_match(helper):
    helper.insert_filter = InsertionFilter(members="Public")
    result = [m.name for m in helper.class_methods(prot="public")]
    assert sorted(result) == sorted(["PublicStaticMethod"])
Example #21
0
def test_public_operators__filter_match(helper):
    helper.insert_filter = InsertionFilter(members="ALL")
    result = [m.name for m in helper.operators(prot="public")]
    assert result == ["operator++"]
def test_public_properties__filter_match(helper):
    helper.insert_filter = InsertionFilter(members="Public")
    result = [m.name for m in helper.properties(prot="public")]
    assert result == ["PublicProperty"]
Example #23
0
def test_public_destructors__filter_match(helper):
    helper.insert_filter = InsertionFilter(members="~MyClass")
    result = list(helper.destructors(prot="public"))
    assert len(result) == 1
    assert result[0].name == "~MyClass"
    assert result[0].prot == "public"
Example #24
0
def test_public_static_methods__no_filter(python_class):
    result = list(m.name for m in public_static_methods(python_class, InsertionFilter()))
    assert sorted(result) == sorted(["public_static_method"])
Example #25
0
def test_public_methods__filter_match(helper):
    helper.insert_filter = InsertionFilter(members="Public.*")
    result = [m.name for m in helper.methods(prot="public")]
    assert result == ["PublicMethod"]
Example #26
0
def test_public_constructors__no_filter(python_class):
    result = list(m.name for m in public_constructors(python_class, InsertionFilter()))
    assert sorted(result) == sorted(["__init__"])
Example #27
0
def helper(java_class, empty_generating_api):
    return JavaTemplateHelper(empty_generating_api, java_class,
                              InsertionFilter())
Example #28
0
def test_public_constructors__filter_match(python_class):
    result = list(m.name for m in public_constructors(python_class, InsertionFilter(members="ALL")))
    assert sorted(result) == sorted(["__init__"])
Example #29
0
def test_public_constants__filter_no_match(helper):
    helper.insert_filter = InsertionFilter(members="NONE")
    result = [m.name for m in helper.constants(prot="public")]
    assert len(result) == 0
Example #30
0
def test_public_enclosed_types__no_filter(python_class):
    result = list(m.name for m in public_enclosed_types(python_class, InsertionFilter()))
    assert sorted(result) == sorted(["NestedClass"])