diff --git a/playground/test.py b/playground/test.py index f10135f3..788448ba 100644 --- a/playground/test.py +++ b/playground/test.py @@ -7,6 +7,13 @@ to generate the examples below. """ +def myFunc(): + """ + TODO + + """ + pass + def myFunc(param1: str = 'string', param2: int = 5): """ TODO diff --git a/test/languages/php/class-properties.vader b/test/languages/php/class-properties.vader index 31d1c49a..0ad99fe6 100644 --- a/test/languages/php/class-properties.vader +++ b/test/languages/php/class-properties.vader @@ -3,7 +3,7 @@ # # Should resolve its corresponding type defined in the constructor. # ============================================================================== -Given php (class property above the constructor should should resolve its corresponding type via the constructor): +Given php (class properties above and below the constructor should should resolve its corresponding type via the constructor): use Symfony\Component\HttpFoundation\Response; class Test { @@ -12,14 +12,14 @@ Given php (class property above the constructor should should resolve its corres protected $migration; - private $response; - public function __construct(string $name, Migration $migration, Response $response) { $this->migrationName = $name; $this->migration = $migration; $this->response = $response; } + private $response; + } Do (trigger doge): @@ -29,7 +29,7 @@ Do (trigger doge): \ :15\ \ - :20\ + :28\ \ Expect php (generated comments at all properties and constructor function): @@ -47,11 +47,6 @@ Expect php (generated comments at all properties and constructor function): */ protected $migration; - /** - * @var \Symfony\Component\HttpFoundation\Response - */ - private $response; - /** * TODO * @@ -65,4 +60,9 @@ Expect php (generated comments at all properties and constructor function): $this->response = $response; } + /** + * @var \Symfony\Component\HttpFoundation\Response + */ + private $response; + } diff --git a/test/languages/python/class-methods.vader b/test/languages/python/class-methods.vader new file mode 100644 index 00000000..d8846233 --- /dev/null +++ b/test/languages/python/class-methods.vader @@ -0,0 +1,75 @@ +# ============================================================================== +# Class method __init__(). +# ============================================================================== +Given python (class method __init__() with parameters): + class MyClass(object): + + def __init__(self: MyClass): + pass + +Do (trigger doge): + :3\ + \ + +Expect python (generated comment with :param tags): + class MyClass(object): + + def __init__(self: MyClass): + """ + TODO + + :param self MyClass: TODO + """ + pass +# ============================================================================== +# Class method with advanced type hints. +# ============================================================================== +Given python (class method with advanced type hints): + class MyClass(object): + + def myMethod(self: MyClass, param1: Sequence[T]) -> Generator[int, float, str]: + pass + +Do (trigger doge): + :3\ + \ + +Expect python (generated comment with :param tags): + class MyClass(object): + + def myMethod(self: MyClass, param1: Sequence[T]) -> Generator[int, float, str]: + """ + TODO + + :param self MyClass: TODO + :param param1 Sequence[T]: TODO + :rtype Generator[int, float, str]: TODO + """ + pass + +# ============================================================================== +# Class method parameters with *args and **kwargs. +# ============================================================================== +Given python (class method parameters with *args and **kwargs): + class MyClass(object): + + def call(self, *args: str, **kwargs: str) -> str: + pass + +Do (trigger doge): + :3\ + \ + +Expect python (generated comment with :param tags): + class MyClass(object): + + def call(self, *args: str, **kwargs: str) -> str: + """ + TODO + + :param self any: TODO + :param args str: TODO + :param kwargs str: TODO + :rtype str: TODO + """ + pass diff --git a/test/languages/python/functions.vader b/test/languages/python/functions.vader new file mode 100644 index 00000000..fac29c3e --- /dev/null +++ b/test/languages/python/functions.vader @@ -0,0 +1,94 @@ +# ============================================================================== +# Functions without parameters. +# ============================================================================== +Given python (function without parameters): + def myFunc(): + pass + +Do (trigger doge): + \ + +Expect python (no changes): + def myFunc(): + """ + TODO + + """ + pass + +# ============================================================================== +# Functions without type hints. +# ============================================================================== +Given python (function without type hints): + def myFunc(param1 = 'string', param2 = 5, param3, param4): + pass + +Do (trigger doge): + \ + +Expect python (generated comment with :param tags): + def myFunc(param1 = 'string', param2 = 5, param3, param4): + """ + TODO + + :param param1 any: TODO + :param param2 any: TODO + :param param3 any: TODO + :param param4 any: TODO + """ + pass + +# ============================================================================== +# Functions with parameters. +# ============================================================================== +Given python (function with parameters): + def myFunc(param1: str = 'string', param2: int = 5): + pass + +Do (trigger doge): + \ + +Expect python (generated comment with :param tags): + def myFunc(param1: str = 'string', param2: int = 5): + """ + TODO + + :param param1 str: TODO + :param param2 int: TODO + """ + pass + +# ============================================================================== +# Functions with advanced type hint parameters. +# ============================================================================== +Given python (functions with advanced type hint parameters): + def myFunc(param1: Callable[[int], None] = False, param2: Callable[[int, Exception], None] = {}) -> Sequence[T]: + pass + + def myFunc(param1: Sequence[T]) -> Generator[int, float, str]: + pass + +Do (trigger doge): + \ + :11\ + \ + +Expect python (generated comments with :param tags): + def myFunc(param1: Callable[[int], None] = False, param2: Callable[[int, Exception], None] = {}) -> Sequence[T]: + """ + TODO + + :param param1 Callable[[int], None]: TODO + :param param2 Callable[[int, Exception], None]: TODO + :rtype Sequence[T]: TODO + """ + pass + + def myFunc(param1: Sequence[T]) -> Generator[int, float, str]: + """ + TODO + + :param param1 Sequence[T]: TODO + :rtype Generator[int, float, str]: TODO + """ + pass