Skip to content

Commit

Permalink
CTOOLS-373: Updated api_test
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt-Storey-Finbourne committed Oct 2, 2024
1 parent 5fc6adf commit d592101
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions generate/templates/api_test.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,15 @@ class {{#operations}}Test{{classname}}(unittest.IsolatedAsyncioTestCase):
example = examples[numRuns - 1]
{{paramName}}: {{dataType}} = example["value"]
numExamples = len(examples)

tmp_{{paramName}} = {}
if isinstance({{paramName}}, dict):
if hasattr({{complexType}}, 'from_dict') and callable(getattr({{complexType}}, 'from_dict')):
{{paramName}} = {k: {{complexType}}.from_dict(v) for k, v in {{paramName}}.items()}
else:
{{paramName}} = {{complexType}}.from_dict({{paramName}})
if hasattr({{paramName}}, 'from_dict') and callable(getattr({{paramName}}, 'from_dict')):
for k, v in {{paramName}}.items():
if isinstance(v, dict):
tmp_{{paramName}}[k] = {{paramName}}.from_dict(v)
else:
break
{{paramName}} = tmp_{{paramName}}

{{/content}}
{{^content}}
Expand Down

0 comments on commit d592101

Please sign in to comment.