Added decorator tests; fixed README typo

This commit is contained in:
Jef Roosens 2020-08-27 09:41:03 +02:00
parent d1dc46c17b
commit beb5bf49cc
3 changed files with 58 additions and 7 deletions

40
tests/test_decorators.py Normal file
View file

@ -0,0 +1,40 @@
# =====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()