~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_lazy_regex.py

  • Committer: Vincent Ladeuil
  • Date: 2011-11-24 10:47:43 UTC
  • mto: (6321.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 6322.
  • Revision ID: v.ladeuil+lp@free.fr-20111124104743-rxqwhmzqu5k17f24
First cut at a working plugin to avoid conflicts in .po files by shelling out to msgmerge.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Test that lazy regexes are not compiled right away"""
18
18
 
19
 
import pickle
20
19
import re
21
20
 
22
21
from bzrlib import errors
116
115
        pattern = lazy_regex.lazy_compile('[,;]*')
117
116
        self.assertEqual(['x', 'y', 'z'], pattern.split('x,y;z'))
118
117
 
119
 
    def test_pickle(self):
120
 
        # When pickling, just compile the regex.
121
 
        # Sphinx, which we use for documentation, pickles
122
 
        # some compiled regexes.
123
 
        lazy_pattern = lazy_regex.lazy_compile('[,;]*')
124
 
        pickled = pickle.dumps(lazy_pattern)
125
 
        unpickled_lazy_pattern = pickle.loads(pickled)
126
 
        self.assertEqual(['x', 'y', 'z'],
127
 
            unpickled_lazy_pattern.split('x,y;z'))
128
 
 
129
118
 
130
119
class TestInstallLazyCompile(tests.TestCase):
131
120
    """Tests for lazy compiled regexps.