Skip to content

Commit 7c252e0

Browse files
committed
Implement/test LOLWUT command
https://redis.io/commands/lolwut This is a lot of fun to play with: ```python >>> from redis import Redis >>> redis = Redis() >>> print(redis.lolwut(5, 6, 7, 8).decode('utf-8')) ⣴⣶⣶⣶⣶⡆ ⣿⣿⣿⣿⣿⡇ ⠹⡿⠟⣿⡿⠃ ⠀⠀⠀⠀⠀⠀ Georg Nees - schotter, plotter on paper, 1968. Redis ver. 6.0.10 >>> print(redis.lolwut(5, 6, 7, 8).decode('utf-8')) ⢰⣶⣶⣶⣶⡆ ⢿⣿⣿⣿⣿⠁ ⠸⡿⢿⠿⡿⠃ ⠀⠀⠀⠀⠀⠀ Georg Nees - schotter, plotter on paper, 1968. Redis ver. 6.0.10 >>> print(redis.lolwut(5, 6, 7, 8).decode('utf-8')) ⢰⣶⣶⣶⣶⡆ ⣸⣿⣿⣻⣿⡅ ⠿⡿⠻⠿⠿⠁ ⠀⠀⠀⠀⠀⠀ Georg Nees - schotter, plotter on paper, 1968. Redis ver. 6.0.10 >>> ```
1 parent 1a41cfd commit 7c252e0

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

redis/client.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,6 +1438,13 @@ def ping(self):
14381438
"Ping the Redis server"
14391439
return self.execute_command('PING')
14401440

1441+
def lolwut(self, *version_numbers):
1442+
"Get the Redis version and a piece of generative computer art"
1443+
if version_numbers:
1444+
return self.execute_command('LOLWUT VERSION', *version_numbers)
1445+
else:
1446+
return self.execute_command('LOLWUT')
1447+
14411448
def save(self):
14421449
"""
14431450
Tell the Redis server to save its data to disk,

tests/test_commands.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,13 @@ def test_object(self, r):
447447
def test_ping(self, r):
448448
assert r.ping()
449449

450+
def test_lolwut(self, r):
451+
lolwut = r.lolwut().decode('utf-8')
452+
assert 'Redis ver.' in lolwut
453+
454+
lolwut = r.lolwut(5, 6, 7, 8).decode('utf-8')
455+
assert 'Redis ver.' in lolwut
456+
450457
def test_slowlog_get(self, r, slowlog):
451458
assert r.slowlog_reset()
452459
unicode_string = chr(3456) + 'abcd' + chr(3421)

0 commit comments

Comments
 (0)