(self)
| 393 | self.assertEqual(next(it), p) |
| 394 | |
| 395 | def test_translate_matching(self): |
| 396 | match = re.compile(glob.translate('*')).match |
| 397 | self.assertIsNotNone(match('foo')) |
| 398 | self.assertIsNotNone(match('foo.bar')) |
| 399 | self.assertIsNone(match('.foo')) |
| 400 | match = re.compile(glob.translate('.*')).match |
| 401 | self.assertIsNotNone(match('.foo')) |
| 402 | match = re.compile(glob.translate('**', recursive=True)).match |
| 403 | self.assertIsNotNone(match('foo')) |
| 404 | self.assertIsNone(match('.foo')) |
| 405 | self.assertIsNotNone(match(os.path.join('foo', 'bar'))) |
| 406 | self.assertIsNone(match(os.path.join('foo', '.bar'))) |
| 407 | self.assertIsNone(match(os.path.join('.foo', 'bar'))) |
| 408 | self.assertIsNone(match(os.path.join('.foo', '.bar'))) |
| 409 | match = re.compile(glob.translate('**/*', recursive=True)).match |
| 410 | self.assertIsNotNone(match(os.path.join('foo', 'bar'))) |
| 411 | self.assertIsNone(match(os.path.join('foo', '.bar'))) |
| 412 | self.assertIsNone(match(os.path.join('.foo', 'bar'))) |
| 413 | self.assertIsNone(match(os.path.join('.foo', '.bar'))) |
| 414 | match = re.compile(glob.translate('*/**', recursive=True)).match |
| 415 | self.assertIsNotNone(match(os.path.join('foo', 'bar'))) |
| 416 | self.assertIsNone(match(os.path.join('foo', '.bar'))) |
| 417 | self.assertIsNone(match(os.path.join('.foo', 'bar'))) |
| 418 | self.assertIsNone(match(os.path.join('.foo', '.bar'))) |
| 419 | match = re.compile(glob.translate('**/.bar', recursive=True)).match |
| 420 | self.assertIsNotNone(match(os.path.join('foo', '.bar'))) |
| 421 | self.assertIsNone(match(os.path.join('.foo', '.bar'))) |
| 422 | match = re.compile(glob.translate('**/*.*', recursive=True)).match |
| 423 | self.assertIsNone(match(os.path.join('foo', 'bar'))) |
| 424 | self.assertIsNone(match(os.path.join('foo', '.bar'))) |
| 425 | self.assertIsNotNone(match(os.path.join('foo', 'bar.txt'))) |
| 426 | self.assertIsNone(match(os.path.join('foo', '.bar.txt'))) |
| 427 | |
| 428 | def test_translate(self): |
| 429 | def fn(pat): |
nothing calls this directly
no test coverage detected