chiark / gitweb /
documentation/python: explicitly test for string type annotations.
authorVladimír Vondruš <mosra@centrum.cz>
Thu, 8 Oct 2020 10:34:48 +0000 (12:34 +0200)
committerVladimír Vondruš <mosra@centrum.cz>
Thu, 8 Oct 2020 11:10:53 +0000 (13:10 +0200)
No surprise expected, just to have that here.

documentation/test_python/inspect_annotations/inspect_annotations.html
documentation/test_python/inspect_annotations/inspect_annotations.py

index 2b35cca110a93f20281409eb0262938995375861..f827525126114f2ccd8d5f1b02f34cc506681573 100644 (file)
               <span class="m-doc-wrap-bumper">def <a href="#annotation_optional" class="m-doc-self">annotation_optional</a>(</span><span class="m-doc-wrap">a: typing.Optional[float])</span>
             </dt>
             <dd>Annotation with the Optional type</dd>
+            <dt id="annotation_strings">
+              <span class="m-doc-wrap-bumper">def <a href="#annotation_strings" class="m-doc-self">annotation_strings</a>(</span><span class="m-doc-wrap">param: typing.List[int],
+              another: bool,
+              third: str = &#x27;hello&#x27;) -&gt; float</span>
+            </dt>
+            <dd>Annotated using strings, should result in exactly the same as annotation()</dd>
             <dt id="annotation_tuple_instead_of_tuple">
               <span class="m-doc-wrap-bumper">def <a href="#annotation_tuple_instead_of_tuple" class="m-doc-self">annotation_tuple_instead_of_tuple</a>(</span><span class="m-doc-wrap">a)</span>
             </dt>
index 9c84809402fba8c8e91216235c2fb2f3bb8ce600..11802cb018ca4393a7bb749aebf34c049d2f5716 100644 (file)
@@ -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