独立测试函数 - 基本功能
()
| 253 | decode_responses=True, |
| 254 | ) |
| 255 | r.ping() |
| 256 | print("✓ 成功连接到 Redis 服务器\n") |
| 257 | except redis.ConnectionError: |
| 258 | print("✗ 无法连接到 Redis 服务器") |
| 259 | print("请确保服务器正在运行在 localhost:7379(可用 KIWI_HOST/KIWI_PORT 覆盖)") |
| 260 | sys.exit(1) |
| 261 | |
| 262 | test_count = 0 |
| 263 | passed = 0 |
| 264 | |
| 265 | try: |
| 266 | # 运行测试 |
| 267 | tests = [ |
| 268 | ("基本 MSET 功能", lambda: test_basic(r)), |
| 269 | ("MSET 与 MGET 配合", lambda: test_with_mget(r)), |
| 270 | ("覆盖已存在的键", lambda: test_overwrite(r)), |
| 271 | ("单个键值对", lambda: test_single_pair(r)), |
no test coverage detected