Ticket #12769: ticket12769_tests.diff

File ticket12769_tests.diff, 1.1 KB (added by mrts, 15 years ago)

Added tests for the problem.

  • new file tests/regressiontests/pickle/models.py

    diff --git a/tests/regressiontests/pickle/__init__.py b/tests/regressiontests/pickle/__init__.py
    new file mode 100644
    index 0000000..e69de29
    diff --git a/tests/regressiontests/pickle/models.py b/tests/regressiontests/pickle/models.py
    new file mode 100644
    index 0000000..9b20f29
    - +  
     1from django.db import models
     2from django.utils.translation import ugettext_lazy as _
     3
     4class PickleMe(models.Model):
     5    name = models.CharField(_("Name"), max_length=10)
  • new file tests/regressiontests/pickle/tests.py

    diff --git a/tests/regressiontests/pickle/tests.py b/tests/regressiontests/pickle/tests.py
    new file mode 100644
    index 0000000..de70649
    - +  
     1import unittest
     2import pickle
     3
     4from models import PickleMe
     5
     6class PickleUgettextLazyTest(unittest.TestCase):
     7    def test_pickle_ugettext_lazy(self):
     8        qs1 = PickleMe.objects.filter(name__icontains="pickle")
     9        query_pickled = pickle.dumps(qs1.query)
     10
     11        qs2 = PickleMe.objects.all()
     12        qs2.query = pickle.loads(query_pickled)
     13
     14        self.assertEquals(str(qs1.query), str(qs2.query))
Back to Top