|
5 | 5 | import os |
6 | 6 | import shutil |
7 | 7 |
|
8 | | -class GlobTestsBase(unittest.TestCase): |
| 8 | +class GlobTests(unittest.TestCase): |
9 | 9 |
|
10 | 10 | def norm(self, *parts): |
11 | 11 | return os.path.normpath(os.path.join(self.tempdir, *parts)) |
@@ -45,8 +45,6 @@ def glob(self, *parts): |
45 | 45 | def assertSequencesEqual_noorder(self, l1, l2): |
46 | 46 | self.assertEqual(set(l1), set(l2)) |
47 | 47 |
|
48 | | -class GlobTests(GlobTestsBase): |
49 | | - |
50 | 48 | def test_glob_literal(self): |
51 | 49 | eq = self.assertSequencesEqual_noorder |
52 | 50 | eq(self.glob('a'), [self.norm('a')]) |
@@ -107,67 +105,9 @@ def test_glob_broken_symlinks(self): |
107 | 105 | eq(self.glob('sym1'), [self.norm('sym1')]) |
108 | 106 | eq(self.glob('sym2'), [self.norm('sym2')]) |
109 | 107 |
|
110 | | -class GlobBracesTests(GlobTestsBase): |
111 | | - |
112 | | - def setUp(self): |
113 | | - super(GlobBracesTests, self).setUp() |
114 | | - self.mktemp('c{}d') |
115 | | - self.mktemp('c{deg') |
116 | | - self.mktemp('c{dfg') |
117 | | - self.mktemp('cd{f}g') |
118 | | - self.mktemp('ce{f}g') |
119 | | - self.mktemp('cdf}g') |
120 | | - self.mktemp('cef}g') |
121 | | - |
122 | | - def match_pattern_with_results(self, patterns, paths): |
123 | | - expected = [self.norm(path) for path in [os.path.join(*parts) for parts in paths]] |
124 | | - actual = [os.path.normpath(g) for g in self.glob(*patterns)] |
125 | | - self.assertSequencesEqual_noorder(actual, expected) |
126 | | - |
127 | | - def test_two_terms(self): |
128 | | - self.match_pattern_with_results(['a{aa,ab}'], [["aaa"], ["aab"]]) |
129 | | - |
130 | | - def test_missing_first_plus_nested(self): |
131 | | - self.match_pattern_with_results(['a{,a{a,b}}'], [['a'], ['aaa'], ['aab']]) |
132 | | - |
133 | | - def test_one_subpath_with_two_file_terms(self): |
134 | | - self.match_pattern_with_results(['a', '{D,bcd}'], [['a', 'D'], ['a', 'bcd']]) |
135 | | - |
136 | | - def test_two_subpath_terms_with_two_file_terms(self): |
137 | | - self.match_pattern_with_results(['{aaa,aab}', '{F,zzzF}'], [('aaa', 'zzzF'), ('aab', 'F')]) |
138 | | - |
139 | | - def test_two_subpath_terms_with_wildcard_file_term(self): |
140 | | - self.match_pattern_with_results(['aa{a,b}', '*F'], [('aaa', 'zzzF'), ('aab', 'F')]) |
141 | | - |
142 | | - def test_wildcard_subpath_with_file_missing_first_term(self): |
143 | | - self.match_pattern_with_results(['aa?', '{,zzz}F'], [('aaa', 'zzzF'), ('aab', 'F')]) |
144 | | - |
145 | | - # |
146 | | - # Edge cases where braces should not be expanded |
147 | | - # |
148 | | - def test_empty_braces(self): |
149 | | - self.assertSequencesEqual_noorder(self.glob('c{}d'), [self.norm('c{}d')]) |
150 | | - |
151 | | - def test_missing_end_brace(self): |
152 | | - self.assertSequencesEqual_noorder(self.glob('c{d{e,f}g'), map(self.norm, ['c{deg', 'c{dfg'])) |
153 | | - |
154 | | - def test_second_brace_one_term(self): |
155 | | - self.assertSequencesEqual_noorder(self.glob('c{d,e}{f}g'), map(self.norm, ['cd{f}g', 'ce{f}g'])) |
156 | | - |
157 | | - def test_outer_term_missing_first_brace(self): |
158 | | - self.assertSequencesEqual_noorder(self.glob('c{d,e}f}g'), map(self.norm, ['cdf}g', 'cef}g'])) |
159 | | - |
160 | | - # |
161 | | - # Braces containing folder separators |
162 | | - # |
163 | | - def test_embedded_separator1(self): |
164 | | - self.match_pattern_with_results(['a/{D,bcd/{EF,efg}}'], [('a', 'D'), ('a', 'bcd', 'EF'), ('a', 'bcd', 'efg')]) |
165 | | - |
166 | | - def test_embedded_separator2(self): |
167 | | - self.match_pattern_with_results(['aa{a/zzz,b/}F'], [('aaa', 'zzzF'), ('aab', 'F')]) |
168 | 108 |
|
169 | 109 | def test_main(): |
170 | | - run_unittest(GlobTests, GlobBracesTests) |
| 110 | + run_unittest(GlobTests) |
171 | 111 |
|
172 | 112 |
|
173 | 113 | if __name__ == "__main__": |
|
0 commit comments