diff --git a/doxypypy/doxypypy.py b/doxypypy/doxypypy.py index b45b7ba..1ed76a8 100755 --- a/doxypypy/doxypypy.py +++ b/doxypypy/doxypypy.py @@ -882,6 +882,7 @@ def visit_FunctionDef(self, node, **kwargs): self.generic_visit(node, containingNodes=containingNodes) # Remove the item we pushed onto the containing nodes hierarchy. containingNodes.pop() + visit_AsyncFunctionDef = visit_FunctionDef def visit_ClassDef(self, node, **kwargs): """ diff --git a/doxypypy/test/sample_async.out.py b/doxypypy/test/sample_async.out.py new file mode 100644 index 0000000..790f01e --- /dev/null +++ b/doxypypy/test/sample_async.out.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +## @brief An asynchronous function and an asynchronous method. +# +#Here we're testing out some straightforward Python 3 async +#examples. +# +# @namespace sample_async + + + +## @brief A sample non-asynchronous function. +# +# @namespace sample_async.non_asynchronous_function + +def non_asynchronous_function(): + return "Not async." + +## @brief A sample asynchronous function. +# +# @namespace sample_async.asynchronous_function + +async def asynchronous_function(): + return "Async" + + +## @brief A sample class with an async method. +# +# Nothing special, just a basic Python 3 class that has an +# async method in it. +# +# @namespace sample_async.ClassWithAsyncMethod + +class ClassWithAsyncMethod(): + + ## @brief This is a regular, non-async method. + # + # @namespace sample_async.ClassWithAsyncMethod.non_asynchronous_method + + def non_asynchronous_method(self): + return "Not async." + + ## @brief This is an asynchronous method. + # + # @namespace sample_async.ClassWithAsyncMethod.asynchronous_method + + async def asynchronous_method(self): + return "Async" + diff --git a/doxypypy/test/sample_async.outbare.py b/doxypypy/test/sample_async.outbare.py new file mode 100644 index 0000000..69b3b0e --- /dev/null +++ b/doxypypy/test/sample_async.outbare.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +## +#An asynchronous function and an asynchronous method. +# +#Here we're testing out some straightforward Python 3 async +#examples. +# + + +## +# A sample non-asynchronous function. +# +def non_asynchronous_function(): + return "Not async." + +## +# A sample asynchronous function. +# +async def asynchronous_function(): + return "Async" + + +## +# A sample class with an async method. +# +# Nothing special, just a basic Python 3 class that has an +# async method in it. +# +class ClassWithAsyncMethod(): + + ## + # This is a regular, non-async method. + # + def non_asynchronous_method(self): + return "Not async." + + ## + # This is an asynchronous method. + # + async def asynchronous_method(self): + return "Async" + diff --git a/doxypypy/test/sample_async.outnc.py b/doxypypy/test/sample_async.outnc.py new file mode 100644 index 0000000..790f01e --- /dev/null +++ b/doxypypy/test/sample_async.outnc.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +## @brief An asynchronous function and an asynchronous method. +# +#Here we're testing out some straightforward Python 3 async +#examples. +# +# @namespace sample_async + + + +## @brief A sample non-asynchronous function. +# +# @namespace sample_async.non_asynchronous_function + +def non_asynchronous_function(): + return "Not async." + +## @brief A sample asynchronous function. +# +# @namespace sample_async.asynchronous_function + +async def asynchronous_function(): + return "Async" + + +## @brief A sample class with an async method. +# +# Nothing special, just a basic Python 3 class that has an +# async method in it. +# +# @namespace sample_async.ClassWithAsyncMethod + +class ClassWithAsyncMethod(): + + ## @brief This is a regular, non-async method. + # + # @namespace sample_async.ClassWithAsyncMethod.non_asynchronous_method + + def non_asynchronous_method(self): + return "Not async." + + ## @brief This is an asynchronous method. + # + # @namespace sample_async.ClassWithAsyncMethod.asynchronous_method + + async def asynchronous_method(self): + return "Async" + diff --git a/doxypypy/test/sample_async.outnn.py b/doxypypy/test/sample_async.outnn.py new file mode 100644 index 0000000..1cdf821 --- /dev/null +++ b/doxypypy/test/sample_async.outnn.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +## @brief An asynchronous function and an asynchronous method. +# +#Here we're testing out some straightforward Python 3 async +#examples. +# + + + +## @brief A sample non-asynchronous function. +# + +def non_asynchronous_function(): + return "Not async." + +## @brief A sample asynchronous function. +# + +async def asynchronous_function(): + return "Async" + + +## @brief A sample class with an async method. +# +# Nothing special, just a basic Python 3 class that has an +# async method in it. +# + +class ClassWithAsyncMethod(): + + ## @brief This is a regular, non-async method. + # + + def non_asynchronous_method(self): + return "Not async." + + ## @brief This is an asynchronous method. + # + + async def asynchronous_method(self): + return "Async" + diff --git a/doxypypy/test/sample_async.py b/doxypypy/test/sample_async.py new file mode 100644 index 0000000..63baa30 --- /dev/null +++ b/doxypypy/test/sample_async.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +""" +An asynchronous function and an asynchronous method. + +Here we're testing out some straightforward Python 3 async +examples. +""" + + +def non_asynchronous_function(): + """ + A sample non-asynchronous function. + """ + return "Not async." + +async def asynchronous_function(): + """ + A sample asynchronous function. + """ + return "Async" + + +class ClassWithAsyncMethod(): + """ + A sample class with an async method. + + Nothing special, just a basic Python 3 class that has an + async method in it. + """ + + def non_asynchronous_method(self): + """ + This is a regular, non-async method. + """ + return "Not async." + + async def asynchronous_method(self): + """ + This is an asynchronous method. + """ + return "Async" + diff --git a/doxypypy/test/test_doxypypy.py b/doxypypy/test/test_doxypypy.py index 4f8ab5f..5fb6967 100755 --- a/doxypypy/test/test_doxypypy.py +++ b/doxypypy/test/test_doxypypy.py @@ -766,6 +766,14 @@ def test_indentProcessing(self): sampleName = 'doxypypy/test/sample_rstexample.py' self.compareAgainstGoldStandard(sampleName, equalIndent=True) + @mark.skipif(version_info < (3, 0), reason="not supported in Python 2") + def test_asyncProcessing(self): + """ + Test the examples with async functions and methods. + """ + sampleName = 'doxypypy/test/sample_async.py' + self.compareAgainstGoldStandard(sampleName) + if __name__ == '__main__': # When executed from the command line, run all the tests via unittest. diff --git a/setup.py b/setup.py index 78b511b..bcde9d3 100755 --- a/setup.py +++ b/setup.py @@ -22,6 +22,9 @@ 'chardet' ], test_suite='doxypypy.test.test_doxypypy', + extras_require={ + 'testing': ['pytest', 'tox'], + }, entry_points={ 'console_scripts': [ 'doxypypy = doxypypy.doxypypy:main'