diff --git a/src/zenlib/util/handle_plural.py b/src/zenlib/util/handle_plural.py index 03b76f7..6cd1c60 100644 --- a/src/zenlib/util/handle_plural.py +++ b/src/zenlib/util/handle_plural.py @@ -1,5 +1,5 @@ __author__ = "desultory" -__version__ = "2.2.0" +__version__ = "2.2.1" from collections.abc import KeysView, ValuesView @@ -27,6 +27,10 @@ def log(msg, level=log_level): log("Expanding list: %s" % focus_arg) for item in focus_arg: function(self, *(other_args + (item,)), **kwargs) + elif isinstance(focus_arg, set): + log("Expanding set: %s" % focus_arg) + for item in focus_arg: + function(self, *(other_args + (item,)), **kwargs) elif isinstance(focus_arg, ValuesView): log("Expanding dict values: %s" % focus_arg) for value in focus_arg: diff --git a/tests/test_handle_plural.py b/tests/test_handle_plural.py index 7dc5b5b..4b25797 100644 --- a/tests/test_handle_plural.py +++ b/tests/test_handle_plural.py @@ -34,6 +34,16 @@ def test_list(self): self.assertEqual(self._test_plural_ints_with_kwarg(extra_arg, test_list), None) self.assertEqual(self._test_data, sum(test_list)) + def test_set(self): + self._test_data = 0 + test_set = {1, 2, 3, 4} + extra_arg = 'a' + self.assertEqual(self._test_plural_ints(extra_arg, test_set), None) + self.assertEqual(self._test_data, sum(test_set)) + self._test_data = 0 + self.assertEqual(self._test_plural_ints_with_kwarg(extra_arg, test_set), None) + self.assertEqual(self._test_data, sum(test_set)) + def test_setting_kwarg(self): self._test_data = 0 test_list = [1, 2, 3, 4]