1from proto_schema_parser
import ast
2from proto_schema_parser
import parser
3from proto_structs.ast
import includes_collection
9@pytest.mark.parametrize(
10 (
'proto_path',
'expected_includes'),
20 'userver/proto-structs/io/userver/proto_structs/hash_map.hpp',
21 'userver/proto-structs/io/userver/proto_structs/hash_map_conv.hpp',
26 'box/autobox/unbreakable_cycle.proto',
28 id=
'unbreakable_cycle',
32def test_includes_are_correct(proto_path, expected_includes) -> None:
34 file_ast = parser.Parser().parse(proto_source)
35 includes = includes_collection.collect(file_ast=file_ast, plugin_options=
None)
36 assert includes == expected_includes
39@pytest.mark.parametrize(
40 (
'file_ast',
'expected_includes'),
46 ast.Package(name=
'google.protobuf'),
47 ast.Import(name=
'google/protobuf/any.proto'),
66 'userver/proto-structs/io/userver/proto_structs/any.hpp',
67 'userver/proto-structs/io/userver/proto_structs/any_conv.hpp',
73def test_deps_within_well_knowns(file_ast, expected_includes) -> None:
74 includes = includes_collection.collect(file_ast=file_ast, plugin_options=
None)
75 assert includes == expected_includes