(self)
| 424 | eq(glob.glob1(self.tempdir, 'a*'), ['a', 'aaa', 'aab']) |
| 425 | |
| 426 | def test_translate_matching(self): |
| 427 | match = re.compile(glob.translate('*')).match |
| 428 | self.assertIsNotNone(match('foo')) |
| 429 | self.assertIsNotNone(match('foo.bar')) |
| 430 | self.assertIsNone(match('.foo')) |
| 431 | match = re.compile(glob.translate('.*')).match |
| 432 | self.assertIsNotNone(match('.foo')) |
| 433 | match = re.compile(glob.translate('**', recursive=True)).match |
| 434 | self.assertIsNotNone(match('foo')) |
| 435 | self.assertIsNone(match('.foo')) |
| 436 | self.assertIsNotNone(match(os.path.join('foo', 'bar'))) |
| 437 | self.assertIsNone(match(os.path.join('foo', '.bar'))) |
| 438 | self.assertIsNone(match(os.path.join('.foo', 'bar'))) |
| 439 | self.assertIsNone(match(os.path.join('.foo', '.bar'))) |
| 440 | match = re.compile(glob.translate('**/*', recursive=True)).match |
| 441 | self.assertIsNotNone(match(os.path.join('foo', 'bar'))) |
| 442 | self.assertIsNone(match(os.path.join('foo', '.bar'))) |
| 443 | self.assertIsNone(match(os.path.join('.foo', 'bar'))) |
| 444 | self.assertIsNone(match(os.path.join('.foo', '.bar'))) |
| 445 | match = re.compile(glob.translate('*/**', recursive=True)).match |
| 446 | self.assertIsNotNone(match(os.path.join('foo', 'bar'))) |
| 447 | self.assertIsNone(match(os.path.join('foo', '.bar'))) |
| 448 | self.assertIsNone(match(os.path.join('.foo', 'bar'))) |
| 449 | self.assertIsNone(match(os.path.join('.foo', '.bar'))) |
| 450 | match = re.compile(glob.translate('**/.bar', recursive=True)).match |
| 451 | self.assertIsNotNone(match(os.path.join('foo', '.bar'))) |
| 452 | self.assertIsNone(match(os.path.join('.foo', '.bar'))) |
| 453 | match = re.compile(glob.translate('**/*.*', recursive=True)).match |
| 454 | self.assertIsNone(match(os.path.join('foo', 'bar'))) |
| 455 | self.assertIsNone(match(os.path.join('foo', '.bar'))) |
| 456 | self.assertIsNotNone(match(os.path.join('foo', 'bar.txt'))) |
| 457 | self.assertIsNone(match(os.path.join('foo', '.bar.txt'))) |
| 458 | |
| 459 | def test_translate(self): |
| 460 | def fn(pat): |
nothing calls this directly
no test coverage detected