diff --git a/src/condor/implementations/utils.py b/src/condor/implementations/utils.py index f0bc611c..a675e778 100644 --- a/src/condor/implementations/utils.py +++ b/src/condor/implementations/utils.py @@ -1,6 +1,6 @@ -def options_to_kwargs(new_cls): - """Process a model clasa and create the kwarg dictionary for the :class:`Options`""" - opts = getattr(new_cls, "Options", None) +def options_to_kwargs(new_cls, attr_name="Options"): + """Process a model class and create the kwarg dictionary for the :class:`Options`""" + opts = getattr(new_cls, attr_name, None) if opts is not None: backend_option = { k: v for k, v in opts.__dict__.items() if not k.startswith("_") diff --git a/tests/test_more_options.py b/tests/test_more_options.py new file mode 100644 index 00000000..1dcb03e2 --- /dev/null +++ b/tests/test_more_options.py @@ -0,0 +1,14 @@ +import condor as co +from condor.implementations.utils import options_to_kwargs + + +def test_options_to_kwargs(): + class ExampleModel(co.ExplicitSystem): + class Options: + in_options = True + + class MiscOptions: + in_misc_options = True + + assert options_to_kwargs(ExampleModel)["in_options"] + assert options_to_kwargs(ExampleModel, attr_name="MiscOptions")["in_misc_options"]