From 66a554bc29b9655e88fc65d1df900c7f0b427f7b Mon Sep 17 00:00:00 2001 From: Vincent Driessen Date: Mon, 6 Jan 2014 23:27:58 +0100 Subject: [PATCH] Change AssertionError to proper TypeError. --- rq/job.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/rq/job.py b/rq/job.py index 98b0b4d..c125189 100644 --- a/rq/job.py +++ b/rq/job.py @@ -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__