40
40
u'name "%s" does match glob "%s" (re=%s)' %
41
41
(name, glob, globster._regex_patterns[0][0].pattern)))
43
def assertMatchBasenameAndFullpath(self, matchset):
44
# test basename matcher
45
self.assertMatch(matchset)
46
# test fullpath matcher
47
self.assertMatch(matchset, glob_prefix='./')
43
49
def test_char_group_digit(self):
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.
52
58
[u'T', u'q', u' ', u'\u8336', u'.'],
53
59
[u'0', u'5', u'\u0663', u'\u06f9', u'\u0f21', u'\xb9']),
55
# test basename matcher
56
self.assertMatch(matchset)
57
# test fullpath matcher
58
self.assertMatch(matchset, glob_prefix='./')
60
62
def test_char_group_space(self):
63
self.assertMatchBasenameAndFullpath([
63
65
[u' ', u'\t', u'\n', u'\xa0', u'\u2000', u'\u2002'],
64
66
[u'a', u'-', u'\u8336', u'.']),
66
68
[u'a', u'-', u'\u8336', u'.'],
67
69
[u' ', u'\t', u'\n', u'\xa0', u'\u2000', u'\u2002']),
69
# test basename matcher
70
self.assertMatch(matchset)
71
# test fullpath matcher
72
self.assertMatch(matchset, glob_prefix='./')
74
72
def test_char_group_alnum(self):
73
self.assertMatchBasenameAndFullpath([
77
75
[u'a', u'Z', u'\u017e', u'\u8336'],
78
76
[u':', u'-', u'\u25cf', u'.']),
80
78
[u':', u'-', u'\u25cf', u'.'],
83
# test basename matcher
84
self.assertMatch(matchset)
85
# test fullpath matcher
86
self.assertMatch(matchset, glob_prefix='./')
88
82
def test_char_group_ascii(self):
83
self.assertMatchBasenameAndFullpath([
91
85
[u'a', u'Q', u'^', u'.'],
92
86
[u'\xcc', u'\u8336']),
94
88
[u'\xcc', u'\u8336'],
95
89
[u'a', u'Q', u'^', u'.']),
97
# test basename matcher
98
self.assertMatch(matchset)
99
# test fullpath matcher
100
self.assertMatch(matchset, glob_prefix='./')
102
92
def test_char_group_blank(self):
93
self.assertMatchBasenameAndFullpath([
106
96
[u'x', u'y', u'z', u'.']),
108
98
[u'x', u'y', u'z', u'.'],
111
# test basename matcher
112
self.assertMatch(matchset)
113
# test fullpath matcher
114
self.assertMatch(matchset, glob_prefix='./')
116
102
def test_char_group_cntrl(self):
103
self.assertMatchBasenameAndFullpath([
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']),
125
# test basename matcher
126
self.assertMatch(matchset)
127
# test fullpath matcher
128
self.assertMatch(matchset, glob_prefix='./')
130
def test_char_groups(self):
112
def test_char_group_range(self):
113
self.assertMatchBasenameAndFullpath([
133
115
[u'a', u'q', u'f'],
134
116
[u'A', u'Q', u'F']),