diff --git a/package.json b/package.json index 8c187e3ff79..5064d91ed24 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ }, "devDependencies": { "@autorest/autorest": "^3.0.0", - "@microsoft.azure/autorest.testserver": "^2.10.61" + "@microsoft.azure/autorest.testserver": "^2.10.62" }, "files": [ "autorest/**/*.py", diff --git a/tasks.py b/tasks.py index c83734c6874..76a27de75be 100644 --- a/tasks.py +++ b/tasks.py @@ -59,7 +59,8 @@ 'AcceptanceTests/MediaTypes': 'media_types.json', 'AcceptanceTests/ObjectType': 'object-type.json', 'AcceptanceTests/NonStringEnums': 'non-string-enum.json', - 'AcceptanceTests/MultipleInheritance': 'multiple-inheritance.json' + 'AcceptanceTests/MultipleInheritance': 'multiple-inheritance.json', + 'AcceptanceTests/NoOperations': 'no-operations.json', } default_azure_mappings = { diff --git a/test/vanilla/AcceptanceTests/test_no_operations.py b/test/vanilla/AcceptanceTests/test_no_operations.py new file mode 100644 index 00000000000..b9a1853f354 --- /dev/null +++ b/test/vanilla/AcceptanceTests/test_no_operations.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- +import sys + +class TestNoOperations: + def test_models(self): + from nooperations.models import Error + + if sys.version_info >= (3,5): + from nooperations.models._models_py3 import Error as ErrorPy3 + assert Error == ErrorPy3 + else: + from nooperations.models._models import Error as ErrorPy2 + assert Error == ErrorPy2 + diff --git a/test/vanilla/Expected/AcceptanceTests/NoOperations/nooperations/__init__.py b/test/vanilla/Expected/AcceptanceTests/NoOperations/nooperations/__init__.py new file mode 100644 index 00000000000..5960c353a89 --- /dev/null +++ b/test/vanilla/Expected/AcceptanceTests/NoOperations/nooperations/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore \ No newline at end of file diff --git a/test/vanilla/Expected/AcceptanceTests/NoOperations/nooperations/_version.py b/test/vanilla/Expected/AcceptanceTests/NoOperations/nooperations/_version.py new file mode 100644 index 00000000000..eae7c95b6fb --- /dev/null +++ b/test/vanilla/Expected/AcceptanceTests/NoOperations/nooperations/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "0.1.0" diff --git a/test/vanilla/Expected/AcceptanceTests/NoOperations/nooperations/models/__init__.py b/test/vanilla/Expected/AcceptanceTests/NoOperations/nooperations/models/__init__.py new file mode 100644 index 00000000000..9c7dad4f9d3 --- /dev/null +++ b/test/vanilla/Expected/AcceptanceTests/NoOperations/nooperations/models/__init__.py @@ -0,0 +1,16 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import Error +except (SyntaxError, ImportError): + from ._models import Error # type: ignore + +__all__ = [ + 'Error', +] diff --git a/test/vanilla/Expected/AcceptanceTests/NoOperations/nooperations/models/_models.py b/test/vanilla/Expected/AcceptanceTests/NoOperations/nooperations/models/_models.py new file mode 100644 index 00000000000..0a4575786fd --- /dev/null +++ b/test/vanilla/Expected/AcceptanceTests/NoOperations/nooperations/models/_models.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import msrest.serialization + + +class Error(msrest.serialization.Model): + """Error. + + :param status: + :type status: int + :param message: + :type message: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Error, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) diff --git a/test/vanilla/Expected/AcceptanceTests/NoOperations/nooperations/models/_models_py3.py b/test/vanilla/Expected/AcceptanceTests/NoOperations/nooperations/models/_models_py3.py new file mode 100644 index 00000000000..5e431739356 --- /dev/null +++ b/test/vanilla/Expected/AcceptanceTests/NoOperations/nooperations/models/_models_py3.py @@ -0,0 +1,37 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Optional + +import msrest.serialization + + +class Error(msrest.serialization.Model): + """Error. + + :param status: + :type status: int + :param message: + :type message: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): + super(Error, self).__init__(**kwargs) + self.status = status + self.message = message diff --git a/test/vanilla/Expected/AcceptanceTests/NoOperations/nooperations/py.typed b/test/vanilla/Expected/AcceptanceTests/NoOperations/nooperations/py.typed new file mode 100644 index 00000000000..e5aff4f83af --- /dev/null +++ b/test/vanilla/Expected/AcceptanceTests/NoOperations/nooperations/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/test/vanilla/Expected/AcceptanceTests/NoOperations/setup.py b/test/vanilla/Expected/AcceptanceTests/NoOperations/setup.py new file mode 100644 index 00000000000..3bb258299b0 --- /dev/null +++ b/test/vanilla/Expected/AcceptanceTests/NoOperations/setup.py @@ -0,0 +1,37 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# coding: utf-8 + +from setuptools import setup, find_packages + +NAME = "nooperationsserviceclient" +VERSION = "0.1.0" + +# To install the library, run the following +# +# python setup.py install +# +# prerequisite: setuptools +# http://pypi.python.org/pypi/setuptools + +REQUIRES = ["msrest>=0.6.18", "azure-core<2.0.0,>=1.8.2"] + +setup( + name=NAME, + version=VERSION, + description="NoOperationsServiceClient", + author_email="", + url="", + keywords=["Swagger", "NoOperationsServiceClient"], + install_requires=REQUIRES, + packages=find_packages(), + include_package_data=True, + long_description="""\ + Service client with no operations. + """ +) diff --git a/test/vanilla/requirements.txt b/test/vanilla/requirements.txt index 49c02081ff4..23cbc70f558 100644 --- a/test/vanilla/requirements.txt +++ b/test/vanilla/requirements.txt @@ -30,6 +30,7 @@ aiohttp;python_full_version>="3.5.2" -e ./Expected/AcceptanceTests/MediaTypes -e ./Expected/AcceptanceTests/ModelFlattening -e ./Expected/AcceptanceTests/MultipleInheritance +-e ./Expected/AcceptanceTests/NoOperations -e ./Expected/AcceptanceTests/NonStringEnums -e ./Expected/AcceptanceTests/ObjectType -e ./Expected/AcceptanceTests/ParameterFlattening