From: Vladimír Vondruš Date: Thu, 8 Oct 2020 10:34:48 +0000 (+0200) Subject: documentation/python: explicitly test for string type annotations. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=17987fbd9d4245f15cd850b231429802b92b8605;p=blog.git documentation/python: explicitly test for string type annotations. No surprise expected, just to have that here. --- diff --git a/documentation/test_python/inspect_annotations/inspect_annotations.html b/documentation/test_python/inspect_annotations/inspect_annotations.html index 2b35cca1..f8275251 100644 --- a/documentation/test_python/inspect_annotations/inspect_annotations.html +++ b/documentation/test_python/inspect_annotations/inspect_annotations.html @@ -101,6 +101,12 @@ def annotation_optional(a: typing.Optional[float])
Annotation with the Optional type
+
+ def annotation_strings(param: typing.List[int], + another: bool, + third: str = 'hello') -> float +
+
Annotated using strings, should result in exactly the same as annotation()
def annotation_tuple_instead_of_tuple(a)
diff --git a/documentation/test_python/inspect_annotations/inspect_annotations.py b/documentation/test_python/inspect_annotations/inspect_annotations.py index 9c848094..11802cb0 100644 --- a/documentation/test_python/inspect_annotations/inspect_annotations.py +++ b/documentation/test_python/inspect_annotations/inspect_annotations.py @@ -34,6 +34,10 @@ def annotation(param: List[int], another: bool, third: str = "hello") -> float: """An annotated function""" pass +def annotation_strings(param: 'List[int]', another: 'bool', third: 'str' = "hello") -> 'float': + """Annotated using strings, should result in exactly the same as annotation()""" + pass + def no_annotation(a, b, z): """Non-annotated function""" pass