Skip to content

Implement/test LOLWUT command #1568

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions redis/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,15 @@ def lastsave(self):
"""
return self.execute_command('LASTSAVE')

def lolwut(self, *version_numbers):
"""Get the Redis version and a piece of generative computer art
See: https://redis.io/commands/lolwut
"""
if version_numbers:
return self.execute_command('LOLWUT VERSION', *version_numbers)
else:
return self.execute_command('LOLWUT')

def migrate(self, host, port, keys, destination_db, timeout,
copy=False, replace=False, auth=None):
"""
Expand Down
8 changes: 8 additions & 0 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,14 @@ def test_info(self, r):
def test_lastsave(self, r):
assert isinstance(r.lastsave(), datetime.datetime)

@skip_if_server_version_lt('5.0.0')
def test_lolwut(self, r):
lolwut = r.lolwut().decode('utf-8')
assert 'Redis ver.' in lolwut

lolwut = r.lolwut(5, 6, 7, 8).decode('utf-8')
assert 'Redis ver.' in lolwut

def test_object(self, r):
r['a'] = 'foo'
assert isinstance(r.object('refcount', 'a'), int)
Expand Down