Skip to content

Commit 0adcc90

Browse files
wouterhhf-kkleinGobot1234
authored
Pythonize input_type name in py_input_message (danielgtaylor#436)
Co-authored-by: konstantin <[email protected]> Co-authored-by: James Hilton-Balfe <[email protected]> Fixes danielgtaylor#427 Fixes danielgtaylor#438
1 parent bfc0fac commit 0adcc90

File tree

4 files changed

+26
-1
lines changed

4 files changed

+26
-1
lines changed

src/betterproto/plugin/models.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ def py_input_message(self) -> Optional[MessageCompiler]:
750750
# comparable with method.input_type
751751
for msg in self.request.all_messages:
752752
if (
753-
msg.py_name == name.replace(".", "")
753+
msg.py_name == pythonize_class_name(name.replace(".", ""))
754754
and msg.output_file.package == package
755755
):
756756
return msg

tests/inputs/config.py

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"googletypes_service_returns_googletype",
2020
"example_service",
2121
"empty_service",
22+
"service_uppercase",
2223
}
2324

2425

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
syntax = "proto3";
2+
3+
package service_uppercase;
4+
5+
message DoTHINGRequest {
6+
string name = 1;
7+
repeated string comments = 2;
8+
}
9+
10+
message DoTHINGResponse {
11+
repeated string names = 1;
12+
}
13+
14+
service Test {
15+
rpc DoThing (DoTHINGRequest) returns (DoTHINGResponse);
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import inspect
2+
3+
from tests.output_betterproto.service_uppercase import TestStub
4+
5+
6+
def test_parameters():
7+
sig = inspect.signature(TestStub.do_thing)
8+
assert len(sig.parameters) == 5, "Expected 5 parameters"

0 commit comments

Comments
 (0)