Skip to content

Commit

Permalink
Adding mixed-case nested parameters test
Browse files Browse the repository at this point in the history
  • Loading branch information
hazmat345 committed Dec 2, 2020
1 parent 8579c71 commit 38627a5
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/decorators_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,33 @@ def foo(_, nested_complex):

self._assert_correct(foo)

def test_mixed_list(self, nested_1, nested_2):
class MyModel(object):
parameters = [
Parameter(
key="key1",
multi=False,
display_name="x",
optional=True,
description="key1",
parameters=nested_1.parameters + [nested_2],
default="xval",
)
]

with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")

@parameter(key="nested_complex", model=MyModel)
def foo(_, nested_complex):
return nested_complex

# Only 1 nested model class object this time
assert len(w) == 1
assert w[0].category == DeprecationWarning

self._assert_correct(foo)

@staticmethod
def _assert_correct(foo):
assert hasattr(foo, "_command")
Expand Down

0 comments on commit 38627a5

Please sign in to comment.