diff options
| author | Jeff Widman <jeff@jeffwidman.com> | 2018-10-22 03:01:48 -0700 |
|---|---|---|
| committer | Jeff Widman <jeff@jeffwidman.com> | 2018-10-22 08:33:13 -0700 |
| commit | 0c3f2c176d6d4ae7bffa8d91795e915bc7b4952c (patch) | |
| tree | 94353238e5d14f61cadc836ce1d85332e75ac626 /test/test_subscription_state.py | |
| parent | 08c77499a2e8bc79d6788d70ef96d77752ed6325 (diff) | |
| download | kafka-python-0c3f2c176d6d4ae7bffa8d91795e915bc7b4952c.tar.gz | |
Fix typo in file name
Diffstat (limited to 'test/test_subscription_state.py')
| -rw-r--r-- | test/test_subscription_state.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/test_subscription_state.py b/test/test_subscription_state.py new file mode 100644 index 0000000..9718f6a --- /dev/null +++ b/test/test_subscription_state.py @@ -0,0 +1,25 @@ +# pylint: skip-file +from __future__ import absolute_import + +import pytest + +from kafka.consumer.subscription_state import SubscriptionState + +@pytest.mark.parametrize(('topic_name', 'expectation'), [ + (0, pytest.raises(TypeError)), + (None, pytest.raises(TypeError)), + ('', pytest.raises(ValueError)), + ('.', pytest.raises(ValueError)), + ('..', pytest.raises(ValueError)), + ('a' * 250, pytest.raises(ValueError)), + ('abc/123', pytest.raises(ValueError)), + ('/abc/123', pytest.raises(ValueError)), + ('/abc123', pytest.raises(ValueError)), + ('name with space', pytest.raises(ValueError)), + ('name*with*stars', pytest.raises(ValueError)), + ('name+with+plus', pytest.raises(ValueError)), +]) +def test_topic_name_validation(topic_name, expectation): + state = SubscriptionState() + with expectation: + state._ensure_valid_topic_name(topic_name) |
