From 466173f5ae5e03b75d42ecc1b4377935ccd94c34 Mon Sep 17 00:00:00 2001 From: Adrien Vannson Date: Fri, 7 Nov 2025 12:10:57 +0100 Subject: [PATCH 1/3] Add missing assert --- betterproto2/tests/test_documentation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/betterproto2/tests/test_documentation.py b/betterproto2/tests/test_documentation.py index e051bb0..f8dc2a4 100644 --- a/betterproto2/tests/test_documentation.py +++ b/betterproto2/tests/test_documentation.py @@ -43,7 +43,7 @@ def test_documentation(requires_grpclib) -> None: def test_escaping(requires_grpclib) -> None: from .outputs.documentation.documentation import ComplexDocumentation - ComplexDocumentation.__doc__ == """ + assert ComplexDocumentation.__doc__ == """ A comment with backslashes \\ and triple quotes \"\"\" Simple quotes are not escaped " """ From 56e0d636102db9b0273d7cf6b5a3ac00116a202a Mon Sep 17 00:00:00 2001 From: Adrien Vannson Date: Fri, 7 Nov 2025 12:23:37 +0100 Subject: [PATCH 2/3] Fix docstring test for Python 3.13 --- betterproto2/tests/test_documentation.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/betterproto2/tests/test_documentation.py b/betterproto2/tests/test_documentation.py index f8dc2a4..ff82b68 100644 --- a/betterproto2/tests/test_documentation.py +++ b/betterproto2/tests/test_documentation.py @@ -1,5 +1,6 @@ import ast import inspect +import sys from tests.util import requires_grpclib # noqa: F401 @@ -43,7 +44,19 @@ def test_documentation(requires_grpclib) -> None: def test_escaping(requires_grpclib) -> None: from .outputs.documentation.documentation import ComplexDocumentation - assert ComplexDocumentation.__doc__ == """ - A comment with backslashes \\ and triple quotes \"\"\" - Simple quotes are not escaped " - """ + if sys.version_info >= (3, 13): + assert ( + ComplexDocumentation.__doc__ + == """ +A comment with backslashes \\ and triple quotes \"\"\" +Simple quotes are not escaped " +""" + ) + else: + assert ( + ComplexDocumentation.__doc__ + == """ + A comment with backslashes \\ and triple quotes \"\"\" + Simple quotes are not escaped " + """ + ) From 7d4d7b436c9eacec79f3f246d418ab2de2572118 Mon Sep 17 00:00:00 2001 From: Adrien Vannson Date: Fri, 7 Nov 2025 12:31:28 +0100 Subject: [PATCH 3/3] Fix older Python version --- betterproto2/tests/test_documentation.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/betterproto2/tests/test_documentation.py b/betterproto2/tests/test_documentation.py index ff82b68..875c787 100644 --- a/betterproto2/tests/test_documentation.py +++ b/betterproto2/tests/test_documentation.py @@ -56,7 +56,7 @@ def test_escaping(requires_grpclib) -> None: assert ( ComplexDocumentation.__doc__ == """ - A comment with backslashes \\ and triple quotes \"\"\" - Simple quotes are not escaped " - """ + A comment with backslashes \\ and triple quotes \"\"\" + Simple quotes are not escaped " + """ )