/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_globbing.py

  • Committer: Kent Gibson
  • Date: 2006-12-08 14:11:16 UTC
  • mto: (2178.1.1 jam-integration)
  • mto: This revision was merged to the branch mainline in revision 2179.
  • Revision ID: warthog618@gmail.com-20061208141116-0mrpch4psu1x82uo
Add helper method to simplify test_char_group cases.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
                    u'name "%s" does match glob "%s" (re=%s)' %
41
41
                    (name, glob, globster._regex_patterns[0][0].pattern)))
42
42
 
 
43
    def assertMatchBasenameAndFullpath(self, matchset):
 
44
        # test basename matcher
 
45
        self.assertMatch(matchset)
 
46
        # test fullpath matcher
 
47
        self.assertMatch(matchset, glob_prefix='./')
 
48
 
43
49
    def test_char_group_digit(self):
44
 
        matchset = [
 
50
        self.assertMatchBasenameAndFullpath([
45
51
            # The definition of digit this uses includes arabic digits from
46
52
            # non-latin scripts (arabic, indic, etc.) and subscript/superscript
47
53
            # digits, but neither roman numerals nor vulgar fractions.
51
57
            (u'[^[:digit:]]',
52
58
             [u'T', u'q', u' ', u'\u8336', u'.'],
53
59
             [u'0', u'5', u'\u0663', u'\u06f9', u'\u0f21', u'\xb9']),
54
 
            ]
55
 
        # test basename matcher
56
 
        self.assertMatch(matchset)
57
 
        # test fullpath matcher
58
 
        self.assertMatch(matchset, glob_prefix='./')
 
60
            ])
59
61
 
60
62
    def test_char_group_space(self):
61
 
        matchset = [
 
63
        self.assertMatchBasenameAndFullpath([
62
64
            (u'[[:space:]]',
63
65
             [u' ', u'\t', u'\n', u'\xa0', u'\u2000', u'\u2002'],
64
66
             [u'a', u'-', u'\u8336', u'.']),
65
67
            (u'[^[:space:]]',
66
68
             [u'a', u'-', u'\u8336', u'.'],
67
69
             [u' ', u'\t', u'\n', u'\xa0', u'\u2000', u'\u2002']),
68
 
            ]
69
 
        # test basename matcher
70
 
        self.assertMatch(matchset)
71
 
        # test fullpath matcher
72
 
        self.assertMatch(matchset, glob_prefix='./')
 
70
            ])
73
71
 
74
72
    def test_char_group_alnum(self):
75
 
        matchset = [
 
73
        self.assertMatchBasenameAndFullpath([
76
74
            (u'[[:alnum:]]',
77
75
             [u'a', u'Z', u'\u017e', u'\u8336'],
78
76
             [u':', u'-', u'\u25cf', u'.']),
79
77
            (u'[^[:alnum:]]',
80
78
             [u':', u'-', u'\u25cf', u'.'],
81
79
             [u'a']),
82
 
            ]
83
 
        # test basename matcher
84
 
        self.assertMatch(matchset)
85
 
        # test fullpath matcher
86
 
        self.assertMatch(matchset, glob_prefix='./')
 
80
            ])
87
81
 
88
82
    def test_char_group_ascii(self):
89
 
        matchset = [
 
83
        self.assertMatchBasenameAndFullpath([
90
84
            (u'[[:ascii:]]',
91
85
             [u'a', u'Q', u'^', u'.'],
92
86
             [u'\xcc', u'\u8336']),
93
87
            (u'[^[:ascii:]]',
94
88
             [u'\xcc', u'\u8336'],
95
89
             [u'a', u'Q', u'^', u'.']),
96
 
            ]
97
 
        # test basename matcher
98
 
        self.assertMatch(matchset)
99
 
        # test fullpath matcher
100
 
        self.assertMatch(matchset, glob_prefix='./')
 
90
            ])
101
91
 
102
92
    def test_char_group_blank(self):
103
 
        matchset = [
 
93
        self.assertMatchBasenameAndFullpath([
104
94
            (u'[[:blank:]]',
105
95
             [u'\t'],
106
96
             [u'x', u'y', u'z', u'.']),
107
97
            (u'[^[:blank:]]',
108
98
             [u'x', u'y', u'z', u'.'],
109
99
             [u'\t']),
110
 
            ]
111
 
        # test basename matcher
112
 
        self.assertMatch(matchset)
113
 
        # test fullpath matcher
114
 
        self.assertMatch(matchset, glob_prefix='./')
 
100
            ])
115
101
 
116
102
    def test_char_group_cntrl(self):
117
 
        matchset = [
 
103
        self.assertMatchBasenameAndFullpath([
118
104
            (u'[[:cntrl:]]',
119
105
             [u'\b', u'\t', '\x7f'],
120
106
             [u'a', u'Q', u'\u8336', u'.']),
121
107
            (u'[^[:cntrl:]]',
122
108
             [u'a', u'Q', u'\u8336', u'.'],
123
109
             [u'\b', u'\t', '\x7f']),
124
 
            ]
125
 
        # test basename matcher
126
 
        self.assertMatch(matchset)
127
 
        # test fullpath matcher
128
 
        self.assertMatch(matchset, glob_prefix='./')
 
110
            ])
129
111
 
130
 
    def test_char_groups(self):
131
 
        matchset = [
 
112
    def test_char_group_range(self):
 
113
        self.assertMatchBasenameAndFullpath([
132
114
            (u'[a-z]',
133
115
             [u'a', u'q', u'f'],
134
116
             [u'A', u'Q', u'F']),
147
129
            (ur'[^\x20-\x30\u8336]',
148
130
             [u'\x1f'],
149
131
             [u'\040', u'\044', u'\u8336']),
150
 
            ]
151
 
        # test basename matcher
152
 
        self.assertMatch(matchset)
153
 
        # test fullpath matcher
154
 
        self.assertMatch(matchset, glob_prefix='./')
 
132
            ])
155
133
 
156
134
    def test_regex(self):
157
135
        self.assertMatch([