Add assertion on class initialization

This commit is contained in:
nemunaire 2015-09-20 15:09:18 +02:00
parent ecd9457691
commit 3c51b1f03b
2 changed files with 7 additions and 1 deletions

View file

@ -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

View file

@ -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