Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(7)  |  Call(7)  |  Derive(0)  |  Import(0)

src/p/o/portfoliyo-HEAD/portfoliyo/tests/test_celery.py   portfoliyo(Download)
        mr = celery.ModelReference('auth', 'user', u.pk)
 
        assert celery.ModelReference.dereference(mr) == u
 
 
        mrl = [celery.ModelReference('auth', 'user', u.pk) for u in l]
 
        assert celery.ModelReference.dereference(mrl) == l
 
 
    def test_dereference_other(self):
        """Trying to dereference a non-reference just returns it."""
        assert celery.ModelReference.dereference(3) == 3
    def test_dereference_bad_model_class(self):
        """If model class cannot be found, raises DereferenceFailed."""
        bad_mr = celery.ModelReference('no', 'such', 'class')
        with pytest.raises(celery.DereferenceFailed):
            celery.ModelReference.dereference(bad_mr)
    def test_dereference_missing_pk(self, db):
        """If model instance cannot be found, raises DereferenceFailed."""
        bad_mr = celery.ModelReference('auth', 'user', -1)
        with pytest.raises(celery.DereferenceFailed):
            celery.ModelReference.dereference(bad_mr)