diff --git a/sumy/utils.py b/sumy/utils.py index 7d0fc92..5eb8e32 100644 --- a/sumy/utils.py +++ b/sumy/utils.py @@ -97,7 +97,7 @@ def __call__(self, sequence): elif isinstance(self._value, (int, float)): return sequence[:int(self._value)] else: - ValueError("Unsuported value of items count '%s'." % self._value) + raise ValueError("Unsuported value of items count '%s'." % self._value) def __repr__(self): return to_string("" % self._value) diff --git a/tests/test_utils/test_utils.py b/tests/test_utils/test_utils.py index 9cf1966..cd30ccc 100644 --- a/tests/test_utils/test_utils.py +++ b/tests/test_utils/test_utils.py @@ -56,6 +56,13 @@ def test_unsupported_items_count(): count([]) +def test_items_count_with_unsupported_init_type(): + count = ItemsCount([]) + + with pytest.raises(ValueError): + count([]) + + def test_normalize_language_with_alpha_2_code(): assert normalize_language("fr") == "french" assert normalize_language("zh") == "chinese"