Change AssertionError to proper TypeError.

This commit is contained in:
Vincent Driessen 2014-01-06 23:27:58 +01:00
parent ce3924c901
commit 66a554bc29
1 changed files with 6 additions and 2 deletions

View File

@ -79,8 +79,12 @@ class Job(object):
args = ()
if kwargs is None:
kwargs = {}
assert isinstance(args, (tuple, list)), '%r is not a valid args list.' % (args,)
assert isinstance(kwargs, dict), '%r is not a valid kwargs dict.' % (kwargs,)
if not isinstance(args, (tuple, list)):
raise TypeError('{0!r} is not a valid args list.'.format(args))
if not isinstance(kwargs, dict):
raise TypeError('{0!r} is not a valid kwargs dict.'.format(kwargs))
job = cls(connection=connection)
if inspect.ismethod(func):
job._instance = func.__self__