Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

hemamaps / celery   python

Repository URL to install this package:

Version: 3.1.23 

/ tests / app / test_exceptions.py

from __future__ import absolute_import

import pickle

from datetime import datetime

from celery.exceptions import Reject, Retry

from celery.tests.case import AppCase


class test_Retry(AppCase):

    def test_when_datetime(self):
        x = Retry('foo', KeyError(), when=datetime.utcnow())
        self.assertTrue(x.humanize())

    def test_pickleable(self):
        x = Retry('foo', KeyError(), when=datetime.utcnow())
        self.assertTrue(pickle.loads(pickle.dumps(x)))


class test_Reject(AppCase):

    def test_attrs(self):
        x = Reject('foo', requeue=True)
        self.assertEqual(x.reason, 'foo')
        self.assertTrue(x.requeue)

    def test_repr(self):
        self.assertTrue(repr(Reject('foo', True)))

    def test_pickleable(self):
        x = Retry('foo', True)
        self.assertTrue(pickle.loads(pickle.dumps(x)))