
python.model_test.handlebars Maven / Gradle / Ivy
# coding: utf-8
{{>partial_header}}
import unittest
import {{packageName}}
{{#each models}}
{{#with model}}
from {{packageName}}.{{modelPackage}}.{{classFilename}} import {{classname}}
from {{packageName}} import configuration
class Test{{classname}}(unittest.TestCase):
"""{{classname}} unit test stubs"""
_configuration = configuration.Configuration()
{{#each testCases}}
{{#with this }}
def test_{{@key}}_{{#if valid}}passes{{else}}fails{{/if}}(self):
# {{description}}
{{#if valid}}
{{classname}}.from_openapi_data_oapg(
{{#with data}}
{{> model_templates/payload_renderer endChar=',' }}
{{/with}}
_configuration=self._configuration
)
{{else}}
with self.assertRaises(({{packageName}}.ApiValueError, {{packageName}}.ApiTypeError)):
{{classname}}.from_openapi_data_oapg(
{{#with data}}
{{> model_templates/payload_renderer endChar=','}}
{{/with}}
_configuration=self._configuration
)
{{/if}}
{{/with}}
{{/each}}
{{/with}}
{{/each}}
if __name__ == '__main__':
unittest.main()
© 2015 - 2025 Weber Informatics LLC | Privacy Policy