Add assertion on class initialization
This commit is contained in:
parent
ecd9457691
commit
3c51b1f03b
2 changed files with 7 additions and 1 deletions
|
@ -23,6 +23,8 @@ def call_game(call, *args, **kargs):
|
||||||
**kargs -- named arguments
|
**kargs -- named arguments
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
assert callable(call)
|
||||||
|
|
||||||
l = list()
|
l = list()
|
||||||
d = kargs
|
d = kargs
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,11 @@ class Message(Abstract):
|
||||||
|
|
||||||
Abstract.__init__(self, call=call, **kargs)
|
Abstract.__init__(self, call=call, **kargs)
|
||||||
|
|
||||||
self.name = name
|
assert regexp is None or type(regexp) is str, regexp
|
||||||
|
assert channels is None or type(channels) is list, channels
|
||||||
|
assert server is None or type(server) is str, server
|
||||||
|
|
||||||
|
self.name = str(name) if name is not None else None
|
||||||
self.regexp = regexp
|
self.regexp = regexp
|
||||||
self.server = server
|
self.server = server
|
||||||
self.channels = channels
|
self.channels = channels
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue