def test_first_key(): assert first_key("foobar", {"foo": 1}) == 1 with pytest.raises(RedisClusterException) as ex: first_key("foobar", {"foo": 1, "bar": 2}) assert unicode( ex.value).startswith("More then 1 result from command: foobar")
def test_first_key(): assert first_key("foobar", {"foo": 1}) == 1 with pytest.raises(RedisClusterException) as ex: first_key("foobar", {"foo": 1, "bar": 2}) assert unicode(ex.value).startswith("More then 1 result from command: foobar") with pytest.raises(AssertionError): first_key("foobar", None)
def test_first_key_value_error(): with pytest.raises(ValueError): first_key("foobar", None)