41 lines
898 B
Python
41 lines
898 B
Python
# =====IMPORTS=====
|
|
# Own imports
|
|
from frank import default, command, daemon
|
|
|
|
|
|
class TestDecorators:
|
|
"""
|
|
This test makes sure the decorated functions return the same result as
|
|
their non-decorated counterparts
|
|
"""
|
|
|
|
def default_no_dec(self):
|
|
return 'default'
|
|
|
|
@default()
|
|
def default_dec(self):
|
|
return self.default_no_dec()
|
|
|
|
def command_no_dec(self):
|
|
return 'command'
|
|
|
|
@command('cmd')
|
|
def command_dec(self):
|
|
return self.command_no_dec()
|
|
|
|
def daemon_no_dec(self):
|
|
return 'daemon'
|
|
|
|
@daemon()
|
|
def daemon_dec(self):
|
|
return self.daemon_no_dec()
|
|
|
|
def test_default(self):
|
|
assert self.default_no_dec() == self.default_dec()
|
|
|
|
def test_command(self):
|
|
assert self.command_no_dec() == self.command_dec()
|
|
|
|
def test_daemon(self):
|
|
assert self.daemon_no_dec() == self.daemon_dec()
|