~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_globbing.py

  • Committer: Martin Pool
  • Date: 2010-07-21 09:58:42 UTC
  • mfrom: (4797.58.7 2.1)
  • mto: (5050.3.13 2.2)
  • mto: This revision was merged to the branch mainline in revision 5365.
  • Revision ID: mbp@canonical.com-20100721095842-hz0obu8gl0x05nty
merge up 2.1 to 2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# along with this program; if not, write to the Free Software
16
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
 
18
 
import re
19
 
 
20
18
from bzrlib import errors
21
19
from bzrlib.globbing import (
22
20
    Globster,
55
53
    def test_char_group_digit(self):
56
54
        self.assertMatchBasenameAndFullpath([
57
55
            # The definition of digit this uses includes arabic digits from
58
 
            # non-latin scripts (arabic, indic, etc.) but neither roman
59
 
            # numerals nor vulgar fractions. Some characters such as
60
 
            # subscript/superscript digits may or may not match depending on
61
 
            # the Python version used, see: <http://bugs.python.org/issue6561>
 
56
            # non-latin scripts (arabic, indic, etc.) and subscript/superscript
 
57
            # digits, but neither roman numerals nor vulgar fractions.
62
58
            (u'[[:digit:]]',
63
 
             [u'0', u'5', u'\u0663', u'\u06f9', u'\u0f21'],
 
59
             [u'0', u'5', u'\u0663', u'\u06f9', u'\u0f21', u'\xb9'],
64
60
             [u'T', u'q', u' ', u'\u8336', u'.']),
65
61
            (u'[^[:digit:]]',
66
62
             [u'T', u'q', u' ', u'\u8336', u'.'],
67
 
             [u'0', u'5', u'\u0663', u'\u06f9', u'\u0f21']),
 
63
             [u'0', u'5', u'\u0663', u'\u06f9', u'\u0f21', u'\xb9']),
68
64
            ])
69
65
 
70
66
    def test_char_group_space(self):
315
311
 
316
312
    def test_bad_pattern(self):
317
313
        """Ensure that globster handles bad patterns cleanly."""
318
 
        patterns = [u'RE:[', u'/home/foo', u'RE:*.cpp']
 
314
        patterns = [u'RE:[']
319
315
        g = Globster(patterns)
320
 
        e = self.assertRaises(errors.InvalidPattern, g.match, 'filename')
321
 
        self.assertContainsRe(e.msg,
322
 
            "File.*ignore.*contains error.*RE:\[.*RE:\*\.cpp", flags=re.DOTALL)
 
316
        e = self.assertRaises(errors.InvalidPattern, g.match, 'foo')
 
317
        self.assertContainsRe(e.msg, "File.*ignore.*contains errors")
323
318
 
324
319
 
325
320
class TestExceptionGlobster(TestCase):