From 5d4f6b4514a60966eeebb63f74782111863e67c6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 14 Jul 2019 17:39:58 +0200 Subject: [PATCH] documentation/python: reduce annotation test to just parsing, not links. Type links are tested in test_inspect.TypeLinks. --- .../inspect_annotations/inspect_annotations.Foo.html | 10 ---------- .../inspect_annotations/inspect_annotations.html | 5 +++-- .../inspect_annotations/inspect_annotations.py | 12 ++++-------- 3 files changed, 7 insertions(+), 20 deletions(-) diff --git a/documentation/test_python/inspect_annotations/inspect_annotations.Foo.html b/documentation/test_python/inspect_annotations/inspect_annotations.Foo.html index 7add22f8..6ee52928 100644 --- a/documentation/test_python/inspect_annotations/inspect_annotations.Foo.html +++ b/documentation/test_python/inspect_annotations/inspect_annotations.Foo.html @@ -29,21 +29,11 @@
  • Reference
  • -
    -

    Methods

    -
    -
    - def string_annotation(self: Foo) -
    -
    String annotations
    -
    -

    Properties

    diff --git a/documentation/test_python/inspect_annotations/inspect_annotations.html b/documentation/test_python/inspect_annotations/inspect_annotations.html index 82891543..cc80ecf1 100644 --- a/documentation/test_python/inspect_annotations/inspect_annotations.html +++ b/documentation/test_python/inspect_annotations/inspect_annotations.html @@ -22,6 +22,7 @@

    inspect_annotations module

    +

    Annotation parsing. For links inside annotations see test_inspect.TypeLinks.

    Contents

      @@ -54,7 +55,7 @@
      def annotation(param: typing.List[int], another: bool, - third: str = 'hello') -> Foo + third: str = 'hello') -> float
      An annotated function
      @@ -111,7 +112,7 @@ def partial_annotation(foo, param: typing.Tuple[int, int], unannotated, - cls: Foo) + cls: object)
      Partially annotated function
      diff --git a/documentation/test_python/inspect_annotations/inspect_annotations.py b/documentation/test_python/inspect_annotations/inspect_annotations.py index 5a4ea25d..27e8a3da 100644 --- a/documentation/test_python/inspect_annotations/inspect_annotations.py +++ b/documentation/test_python/inspect_annotations/inspect_annotations.py @@ -1,3 +1,5 @@ +"""Annotation parsing. For links inside annotations see test_inspect.TypeLinks.""" + import sys from typing import List, Tuple, Dict, Any, Union, Optional, Callable, TypeVar @@ -10,13 +12,7 @@ class Foo: """A property with a type annotation""" pass - # Self-reference is only possible with a string in Py3 - # https://stackoverflow.com/a/33533514 - def string_annotation(self: 'Foo'): - """String annotations""" - pass - -def annotation(param: List[int], another: bool, third: str = "hello") -> Foo: +def annotation(param: List[int], another: bool, third: str = "hello") -> float: """An annotated function""" pass @@ -28,7 +24,7 @@ def no_annotation_default_param(param, another, third = "hello"): """Non-annotated function with a default parameter""" pass -def partial_annotation(foo, param: Tuple[int, int], unannotated, cls: Foo): +def partial_annotation(foo, param: Tuple[int, int], unannotated, cls: object): """Partially annotated function""" pass -- 2.30.2