| 24 | % (filename, pattern)) |
| 25 | |
| 26 | def test_fnmatch(self): |
| 27 | check = self.check_match |
| 28 | check('abc', 'abc') |
| 29 | check('abc', '?*?') |
| 30 | check('abc', '???*') |
| 31 | check('abc', '*???') |
| 32 | check('abc', '???') |
| 33 | check('abc', '*') |
| 34 | check('abc', 'ab[cd]') |
| 35 | check('abc', 'ab[!de]') |
| 36 | check('abc', 'ab[de]', False) |
| 37 | check('a', '??', False) |
| 38 | check('a', 'b', False) |
| 39 | |
| 40 | # these test that '\' is handled correctly in character sets; |
| 41 | # see SF bug #409651 |
| 42 | check('\\', r'[\]') |
| 43 | check('a', r'[!\]') |
| 44 | check('\\', r'[!\]', False) |
| 45 | |
| 46 | # test that filenames with newlines in them are handled correctly. |
| 47 | # http://bugs.python.org/issue6665 |
| 48 | check('foo\nbar', 'foo*') |
| 49 | check('foo\nbar\n', 'foo*') |
| 50 | check('\nfoo', 'foo*', False) |
| 51 | check('\n', '*') |
| 52 | |
| 53 | def test_slow_fnmatch(self): |
| 54 | check = self.check_match |