From 30845afc9f9ecfd933c9841b22307555b4fa5109 Mon Sep 17 00:00:00 2001 From: laixintao Date: Fri, 16 Feb 2024 17:48:02 +0800 Subject: [PATCH] add test case for password containing `@` symbol (#488) * add test case for password containing `@` symbol https://github.com/laixintao/iredis/issues/487 * black format * fix black * bugfix: black using 2.24 --- iredis/client.py | 1 + iredis/renders.py | 1 + poetry.lock | 62 ++--------------------------------- tests/unittests/test_entry.py | 13 ++++++++ 4 files changed, 18 insertions(+), 59 deletions(-) diff --git a/iredis/client.py b/iredis/client.py index f7164b89..a9526385 100644 --- a/iredis/client.py +++ b/iredis/client.py @@ -1,6 +1,7 @@ """ IRedis client. """ + import re import os import sys diff --git a/iredis/renders.py b/iredis/renders.py index d695407e..94582635 100644 --- a/iredis/renders.py +++ b/iredis/renders.py @@ -4,6 +4,7 @@ func(redis-response) -> formatted result(str) """ + import logging import time from packaging.version import parse as version_parse diff --git a/poetry.lock b/poetry.lock index 752359a1..73a4b58b 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.5.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.7.0 and should not be changed by hand. [[package]] name = "async-timeout" @@ -11,9 +11,6 @@ files = [ {file = "async_timeout-4.0.3-py3-none-any.whl", hash = "sha256:7405140ff1230c310e51dc27b3145b9092d659ce68ff733fb0cefe3ee42be028"}, ] -[package.dependencies] -typing-extensions = {version = ">=3.6.5", markers = "python_version < \"3.8\""} - [[package]] name = "click" version = "8.1.7" @@ -27,7 +24,6 @@ files = [ [package.dependencies] colorama = {version = "*", markers = "platform_system == \"Windows\""} -importlib-metadata = {version = "*", markers = "python_version < \"3.8\""} [[package]] name = "colorama" @@ -68,26 +64,6 @@ files = [ [package.extras] test = ["pytest (>=6)"] -[[package]] -name = "importlib-metadata" -version = "6.7.0" -description = "Read metadata from Python packages" -optional = false -python-versions = ">=3.7" -files = [ - {file = "importlib_metadata-6.7.0-py3-none-any.whl", hash = "sha256:cb52082e659e97afc5dac71e79de97d8681de3aa07ff18578330904a9d18e5b5"}, - {file = "importlib_metadata-6.7.0.tar.gz", hash = "sha256:1aaf550d4f73e5d6783e7acb77aec43d49da8017410afae93822cc9cca98c4d4"}, -] - -[package.dependencies] -typing-extensions = {version = ">=3.6.4", markers = "python_version < \"3.8\""} -zipp = ">=0.5" - -[package.extras] -docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] -perf = ["ipython"] -testing = ["flufl.flake8", "importlib-resources (>=1.3)", "packaging", "pyfakefs", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-mypy (>=0.9.1)", "pytest-perf (>=0.9.2)", "pytest-ruff"] - [[package]] name = "iniconfig" version = "2.0.0" @@ -180,9 +156,6 @@ files = [ {file = "pluggy-1.2.0.tar.gz", hash = "sha256:d12f0c4b579b15f5e054301bb226ee85eeeba08ffec228092f8defbaa3a4c4b3"}, ] -[package.dependencies] -importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} - [package.extras] dev = ["pre-commit", "tox"] testing = ["pytest", "pytest-benchmark"] @@ -240,7 +213,6 @@ files = [ [package.dependencies] colorama = {version = "*", markers = "sys_platform == \"win32\""} exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} -importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} iniconfig = "*" packaging = "*" pluggy = ">=0.12,<2.0" @@ -287,8 +259,6 @@ files = [ [package.dependencies] async-timeout = {version = ">=4.0.2", markers = "python_full_version <= \"3.11.2\""} -importlib-metadata = {version = ">=1.0", markers = "python_version < \"3.8\""} -typing-extensions = {version = "*", markers = "python_version < \"3.8\""} [package.extras] hiredis = ["hiredis (>=1.0.0)"] @@ -316,17 +286,6 @@ files = [ {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, ] -[[package]] -name = "typing-extensions" -version = "4.7.1" -description = "Backported and Experimental Type Hints for Python 3.7+" -optional = false -python-versions = ">=3.7" -files = [ - {file = "typing_extensions-4.7.1-py3-none-any.whl", hash = "sha256:440d5dd3af93b060174bf433bccd69b0babc3b15b1a8dca43789fd7f61514b36"}, - {file = "typing_extensions-4.7.1.tar.gz", hash = "sha256:b75ddc264f0ba5615db7ba217daeb99701ad295353c45f9e95963337ceeeffb2"}, -] - [[package]] name = "wcwidth" version = "0.1.9" @@ -338,22 +297,7 @@ files = [ {file = "wcwidth-0.1.9.tar.gz", hash = "sha256:ee73862862a156bf77ff92b09034fc4825dd3af9cf81bc5b360668d425f3c5f1"}, ] -[[package]] -name = "zipp" -version = "3.15.0" -description = "Backport of pathlib-compatible object wrapper for zip files" -optional = false -python-versions = ">=3.7" -files = [ - {file = "zipp-3.15.0-py3-none-any.whl", hash = "sha256:48904fc76a60e542af151aded95726c1a5c34ed43ab4134b597665c86d7ad556"}, - {file = "zipp-3.15.0.tar.gz", hash = "sha256:112929ad649da941c23de50f356a2b5570c954b65150642bccdd66bf194d224b"}, -] - -[package.extras] -docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] -testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more-itertools", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)"] - [metadata] lock-version = "2.0" -python-versions = "^3.7" -content-hash = "33eaaf0e62340be5fa5c74233fd0760e61c9635cbad8f38d625f3c253fb9df4c" +python-versions = "^3.8" +content-hash = "6237a8e8d2a29bc969f11386bfb6b7fca4006212b57e91f3e120cc7353e36e55" diff --git a/tests/unittests/test_entry.py b/tests/unittests/test_entry.py index e53861e6..99d69312 100644 --- a/tests/unittests/test_entry.py +++ b/tests/unittests/test_entry.py @@ -174,6 +174,19 @@ def test_command_shell_options_higher_priority(): verify_ssl=None, ), ), + ( + "redis://username:pass@word@localhost:12345/2", + DSN( + scheme="redis", + host="localhost", + port=12345, + path=None, + db=2, + username="username", + password="pass@word", + verify_ssl=None, + ), + ), ( "redis://username@localhost:12345", DSN(