From 38627a526454ff599952ba6fbb51adcca810aebe Mon Sep 17 00:00:00 2001 From: Matt Patrick Date: Wed, 2 Dec 2020 17:31:24 -0500 Subject: [PATCH] Adding mixed-case nested parameters test --- test/decorators_test.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/test/decorators_test.py b/test/decorators_test.py index 73ccc91a..d6b06d20 100644 --- a/test/decorators_test.py +++ b/test/decorators_test.py @@ -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")