Skip to content

Commit b2febac

Browse files
committed
add a few more test cases
Signed-off-by: Aidan Jensen <aidandj.github@gmail.com>
1 parent 945748e commit b2febac

File tree

10 files changed

+43
-16
lines changed

10 files changed

+43
-16
lines changed

proto/testproto/test.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ message DeprecatedMessage {
176176

177177
optional string a_string = 1;
178178
optional string deprecated_field = 2 [deprecated = true];
179+
// This field is deprecated with comment
180+
optional string deprecated_field_with_comment = 3 [deprecated = true];
179181
}
180182

181183
message DeprecatedMessageBadComment {

stubtest_allowlist.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,3 +257,4 @@ testproto.grpc.dummy_pb2_grpc.EmptyServiceStub.__init__
257257
# Because we generate message fields as properties when deprecated they do not exist at runtime
258258
testproto.grpc.dummy_pb2.DeprecatedRequest.old_field
259259
testproto.test_pb2.DeprecatedMessage.deprecated_field
260+
testproto.test_pb2.DeprecatedMessage.deprecated_field_with_comment

test/generated/testproto/test_pb2.pyi

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,22 +441,34 @@ class DeprecatedMessage(google.protobuf.message.Message):
441441

442442
A_STRING_FIELD_NUMBER: builtins.int
443443
DEPRECATED_FIELD_FIELD_NUMBER: builtins.int
444+
DEPRECATED_FIELD_WITH_COMMENT_FIELD_NUMBER: builtins.int
444445
a_string: builtins.str
445446
@property
446447
@deprecated("""This field has been marked as deprecated using proto field options.""")
447448
def deprecated_field(self) -> builtins.str: ...
448449
@deprecated_field.setter
449450
@deprecated("""This field has been marked as deprecated using proto field options.""")
450451
def deprecated_field(self, value: builtins.str) -> None: ...
452+
@property
453+
@deprecated("""This field has been marked as deprecated using proto field options.""")
454+
def deprecated_field_with_comment(self) -> builtins.str:
455+
"""This field is deprecated with comment"""
456+
457+
@deprecated_field_with_comment.setter
458+
@deprecated("""This field has been marked as deprecated using proto field options.""")
459+
def deprecated_field_with_comment(self, value: builtins.str) -> None:
460+
"""This field is deprecated with comment"""
461+
451462
def __init__(
452463
self,
453464
*,
454465
a_string: builtins.str | None = ...,
455466
deprecated_field: builtins.str | None = ...,
467+
deprecated_field_with_comment: builtins.str | None = ...,
456468
) -> None: ...
457-
_HasFieldArgType: typing_extensions.TypeAlias = typing.Literal["a_string", b"a_string", "deprecated_field", b"deprecated_field"]
469+
_HasFieldArgType: typing_extensions.TypeAlias = typing.Literal["a_string", b"a_string", "deprecated_field", b"deprecated_field", "deprecated_field_with_comment", b"deprecated_field_with_comment"]
458470
def HasField(self, field_name: _HasFieldArgType) -> builtins.bool: ...
459-
_ClearFieldArgType: typing_extensions.TypeAlias = typing.Literal["a_string", b"a_string", "deprecated_field", b"deprecated_field"]
471+
_ClearFieldArgType: typing_extensions.TypeAlias = typing.Literal["a_string", b"a_string", "deprecated_field", b"deprecated_field", "deprecated_field_with_comment", b"deprecated_field_with_comment"]
460472
def ClearField(self, field_name: _ClearFieldArgType) -> None: ...
461473

462474
Global___DeprecatedMessage: typing_extensions.TypeAlias = DeprecatedMessage

test/generated_concrete/testproto/test_pb2.pyi

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,22 +441,34 @@ class DeprecatedMessage(google.protobuf.message.Message):
441441

442442
A_STRING_FIELD_NUMBER: builtins.int
443443
DEPRECATED_FIELD_FIELD_NUMBER: builtins.int
444+
DEPRECATED_FIELD_WITH_COMMENT_FIELD_NUMBER: builtins.int
444445
a_string: builtins.str
445446
@property
446447
@deprecated("""This field has been marked as deprecated using proto field options.""")
447448
def deprecated_field(self) -> builtins.str: ...
448449
@deprecated_field.setter
449450
@deprecated("""This field has been marked as deprecated using proto field options.""")
450451
def deprecated_field(self, value: builtins.str) -> None: ...
452+
@property
453+
@deprecated("""This field has been marked as deprecated using proto field options.""")
454+
def deprecated_field_with_comment(self) -> builtins.str:
455+
"""This field is deprecated with comment"""
456+
457+
@deprecated_field_with_comment.setter
458+
@deprecated("""This field has been marked as deprecated using proto field options.""")
459+
def deprecated_field_with_comment(self, value: builtins.str) -> None:
460+
"""This field is deprecated with comment"""
461+
451462
def __init__(
452463
self,
453464
*,
454465
a_string: builtins.str | None = ...,
455466
deprecated_field: builtins.str | None = ...,
467+
deprecated_field_with_comment: builtins.str | None = ...,
456468
) -> None: ...
457-
_HasFieldArgType: typing_extensions.TypeAlias = typing.Literal["a_string", b"a_string", "deprecated_field", b"deprecated_field"]
469+
_HasFieldArgType: typing_extensions.TypeAlias = typing.Literal["a_string", b"a_string", "deprecated_field", b"deprecated_field", "deprecated_field_with_comment", b"deprecated_field_with_comment"]
458470
def HasField(self, field_name: _HasFieldArgType) -> builtins.bool: ...
459-
_ClearFieldArgType: typing_extensions.TypeAlias = typing.Literal["a_string", b"a_string", "deprecated_field", b"deprecated_field"]
471+
_ClearFieldArgType: typing_extensions.TypeAlias = typing.Literal["a_string", b"a_string", "deprecated_field", b"deprecated_field", "deprecated_field_with_comment", b"deprecated_field_with_comment"]
460472
def ClearField(self, field_name: _ClearFieldArgType) -> None: ...
461473

462474
Global___DeprecatedMessage: typing_extensions.TypeAlias = DeprecatedMessage

test_negative/output.expected.3.10

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ test/generated/testproto/test_pb2.pyi:96: error: class testproto.test_pb2.Deprec
1515
"Quotes in comments"
1616
and 'single quotes'
1717
Trailing comment [deprecated]
18-
test/generated/testproto/test_pb2.pyi:462: error: class testproto.test_pb2.DeprecatedMessage is deprecated: This message is deprecated [deprecated]
19-
test/generated/testproto/test_pb2.pyi:481: error: class testproto.test_pb2.DeprecatedMessageBadComment is deprecated: This message has been marked as deprecated using proto message options. [deprecated]
18+
test/generated/testproto/test_pb2.pyi:474: error: class testproto.test_pb2.DeprecatedMessage is deprecated: This message is deprecated [deprecated]
19+
test/generated/testproto/test_pb2.pyi:493: error: class testproto.test_pb2.DeprecatedMessageBadComment is deprecated: This message has been marked as deprecated using proto message options. [deprecated]
2020
test_negative/negative.py:16: error: class testproto.grpc.dummy_pb2.DeprecatedRequest is deprecated: This message has been marked as deprecated using proto message options. [deprecated]
2121
test_negative/negative.py:21: error: class testproto.grpc.dummy_pb2_grpc.DeprecatedServiceServicer is deprecated: This service is deprecated [deprecated]
2222
test_negative/negative.py:21: error: class testproto.grpc.dummy_pb2_grpc.DeprecatedServiceStub is deprecated: This service is deprecated [deprecated]

test_negative/output.expected.3.11

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ test/generated/testproto/test_pb2.pyi:96: error: class testproto.test_pb2.Deprec
1515
"Quotes in comments"
1616
and 'single quotes'
1717
Trailing comment [deprecated]
18-
test/generated/testproto/test_pb2.pyi:462: error: class testproto.test_pb2.DeprecatedMessage is deprecated: This message is deprecated [deprecated]
19-
test/generated/testproto/test_pb2.pyi:481: error: class testproto.test_pb2.DeprecatedMessageBadComment is deprecated: This message has been marked as deprecated using proto message options. [deprecated]
18+
test/generated/testproto/test_pb2.pyi:474: error: class testproto.test_pb2.DeprecatedMessage is deprecated: This message is deprecated [deprecated]
19+
test/generated/testproto/test_pb2.pyi:493: error: class testproto.test_pb2.DeprecatedMessageBadComment is deprecated: This message has been marked as deprecated using proto message options. [deprecated]
2020
test_negative/negative.py:16: error: class testproto.grpc.dummy_pb2.DeprecatedRequest is deprecated: This message has been marked as deprecated using proto message options. [deprecated]
2121
test_negative/negative.py:21: error: class testproto.grpc.dummy_pb2_grpc.DeprecatedServiceServicer is deprecated: This service is deprecated [deprecated]
2222
test_negative/negative.py:21: error: class testproto.grpc.dummy_pb2_grpc.DeprecatedServiceStub is deprecated: This service is deprecated [deprecated]

test_negative/output.expected.3.12

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ test/generated/testproto/test_pb2.pyi:96: error: class testproto.test_pb2.Deprec
1515
"Quotes in comments"
1616
and 'single quotes'
1717
Trailing comment [deprecated]
18-
test/generated/testproto/test_pb2.pyi:462: error: class testproto.test_pb2.DeprecatedMessage is deprecated: This message is deprecated [deprecated]
19-
test/generated/testproto/test_pb2.pyi:481: error: class testproto.test_pb2.DeprecatedMessageBadComment is deprecated: This message has been marked as deprecated using proto message options. [deprecated]
18+
test/generated/testproto/test_pb2.pyi:474: error: class testproto.test_pb2.DeprecatedMessage is deprecated: This message is deprecated [deprecated]
19+
test/generated/testproto/test_pb2.pyi:493: error: class testproto.test_pb2.DeprecatedMessageBadComment is deprecated: This message has been marked as deprecated using proto message options. [deprecated]
2020
test_negative/negative.py:16: error: class testproto.grpc.dummy_pb2.DeprecatedRequest is deprecated: This message has been marked as deprecated using proto message options. [deprecated]
2121
test_negative/negative.py:21: error: class testproto.grpc.dummy_pb2_grpc.DeprecatedServiceServicer is deprecated: This service is deprecated [deprecated]
2222
test_negative/negative.py:21: error: class testproto.grpc.dummy_pb2_grpc.DeprecatedServiceStub is deprecated: This service is deprecated [deprecated]

test_negative/output.expected.3.13

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ test/generated/testproto/test_pb2.pyi:96: error: class testproto.test_pb2.Deprec
1515
"Quotes in comments"
1616
and 'single quotes'
1717
Trailing comment [deprecated]
18-
test/generated/testproto/test_pb2.pyi:462: error: class testproto.test_pb2.DeprecatedMessage is deprecated: This message is deprecated [deprecated]
19-
test/generated/testproto/test_pb2.pyi:481: error: class testproto.test_pb2.DeprecatedMessageBadComment is deprecated: This message has been marked as deprecated using proto message options. [deprecated]
18+
test/generated/testproto/test_pb2.pyi:474: error: class testproto.test_pb2.DeprecatedMessage is deprecated: This message is deprecated [deprecated]
19+
test/generated/testproto/test_pb2.pyi:493: error: class testproto.test_pb2.DeprecatedMessageBadComment is deprecated: This message has been marked as deprecated using proto message options. [deprecated]
2020
test_negative/negative.py:16: error: class testproto.grpc.dummy_pb2.DeprecatedRequest is deprecated: This message has been marked as deprecated using proto message options. [deprecated]
2121
test_negative/negative.py:21: error: class testproto.grpc.dummy_pb2_grpc.DeprecatedServiceServicer is deprecated: This service is deprecated [deprecated]
2222
test_negative/negative.py:21: error: class testproto.grpc.dummy_pb2_grpc.DeprecatedServiceStub is deprecated: This service is deprecated [deprecated]

test_negative/output.expected.3.14

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ test/generated/testproto/test_pb2.pyi:96: error: class testproto.test_pb2.Deprec
1515
"Quotes in comments"
1616
and 'single quotes'
1717
Trailing comment [deprecated]
18-
test/generated/testproto/test_pb2.pyi:462: error: class testproto.test_pb2.DeprecatedMessage is deprecated: This message is deprecated [deprecated]
19-
test/generated/testproto/test_pb2.pyi:481: error: class testproto.test_pb2.DeprecatedMessageBadComment is deprecated: This message has been marked as deprecated using proto message options. [deprecated]
18+
test/generated/testproto/test_pb2.pyi:474: error: class testproto.test_pb2.DeprecatedMessage is deprecated: This message is deprecated [deprecated]
19+
test/generated/testproto/test_pb2.pyi:493: error: class testproto.test_pb2.DeprecatedMessageBadComment is deprecated: This message has been marked as deprecated using proto message options. [deprecated]
2020
test_negative/negative.py:16: error: class testproto.grpc.dummy_pb2.DeprecatedRequest is deprecated: This message has been marked as deprecated using proto message options. [deprecated]
2121
test_negative/negative.py:21: error: class testproto.grpc.dummy_pb2_grpc.DeprecatedServiceServicer is deprecated: This service is deprecated [deprecated]
2222
test_negative/negative.py:21: error: class testproto.grpc.dummy_pb2_grpc.DeprecatedServiceStub is deprecated: This service is deprecated [deprecated]

test_negative/output.expected.3.9

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ test/generated/testproto/test_pb2.pyi:96: error: class testproto.test_pb2.Deprec
1515
"Quotes in comments"
1616
and 'single quotes'
1717
Trailing comment [deprecated]
18-
test/generated/testproto/test_pb2.pyi:462: error: class testproto.test_pb2.DeprecatedMessage is deprecated: This message is deprecated [deprecated]
19-
test/generated/testproto/test_pb2.pyi:481: error: class testproto.test_pb2.DeprecatedMessageBadComment is deprecated: This message has been marked as deprecated using proto message options. [deprecated]
18+
test/generated/testproto/test_pb2.pyi:474: error: class testproto.test_pb2.DeprecatedMessage is deprecated: This message is deprecated [deprecated]
19+
test/generated/testproto/test_pb2.pyi:493: error: class testproto.test_pb2.DeprecatedMessageBadComment is deprecated: This message has been marked as deprecated using proto message options. [deprecated]
2020
test_negative/negative.py:16: error: class testproto.grpc.dummy_pb2.DeprecatedRequest is deprecated: This message has been marked as deprecated using proto message options. [deprecated]
2121
test_negative/negative.py:21: error: class testproto.grpc.dummy_pb2_grpc.DeprecatedServiceServicer is deprecated: This service is deprecated [deprecated]
2222
test_negative/negative.py:21: error: class testproto.grpc.dummy_pb2_grpc.DeprecatedServiceStub is deprecated: This service is deprecated [deprecated]

0 commit comments

Comments
 (0)