userver: /data/code/userver/libraries/proto-structs/codegen-tests/pytest/ast/test_includes_list.py Source File
Loading...
Searching...
No Matches
test_includes_list.py
1from proto_schema_parser import parser
2from proto_structs.ast import includes_collection
3import pytest
4
5import utils
6
7
8@pytest.mark.parametrize(
9 ('proto_path', 'expected_includes'),
10 [
11 pytest.param(
12 'enums/names.proto',
13 [],
14 ),
15 pytest.param(
16 'maps/basic.proto',
17 [
18 'userver/proto-structs/io/userver/proto_structs/hash_map.hpp',
19 'userver/proto-structs/io/userver/proto_structs/hash_map_conv.hpp',
20 ],
21 ),
22 pytest.param(
23 'box/autobox/unbreakable_cycle.proto',
24 [
25 'userver/proto-structs/io/userver/utils/box.hpp',
26 'userver/proto-structs/io/userver/utils/box_conv.hpp',
27 ],
28 ),
29 ],
30)
31def test_includes_are_correct(proto_path, expected_includes) -> None:
32 proto_source = utils.load_proto_source_file(proto_path)
33 file_ast = parser.Parser().parse(proto_source)
34 includes = includes_collection.collect(file_ast=file_ast, plugin_options=None)
35 assert includes == expected_includes