Skip to content

Commit

Permalink
Add test for pickling & unpickling lazy strings
Browse files Browse the repository at this point in the history
  • Loading branch information
MichiK committed Jul 19, 2016
1 parent 8319a7f commit 92788da
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/tests.py
Expand Up @@ -5,6 +5,8 @@
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))

import pickle

import unittest
from decimal import Decimal
import flask
Expand Down Expand Up @@ -60,6 +62,13 @@ def test_lazy_old_style_formatting(self):
lazy_string = lazy_gettext(u'test')
assert u'Hello %s' % lazy_string == u'Hello test'

def test_lazy_pickling(self):
lazy_string = lazy_gettext(u'Foo')
pickled = pickle.dumps(lazy_string)
unpickled = pickle.loads(pickled)

assert unpickled == lazy_string


class DateFormattingTestCase(unittest.TestCase):

Expand Down

0 comments on commit 92788da

Please sign in to comment.