return [basename]
return []
-_deprecated_function_message = (
- "{name} is deprecated and will be removed in Python {remove}. Use "
- "glob.glob and pass a directory to its root_dir argument instead."
-)
-
-def glob0(dirname, pattern):
- import warnings
- warnings._deprecated("glob.glob0", _deprecated_function_message, remove=(3, 15))
- return _glob0(dirname, pattern, None, False)
-
-def glob1(dirname, pattern):
- import warnings
- warnings._deprecated("glob.glob1", _deprecated_function_message, remove=(3, 15))
- return _glob1(dirname, pattern, None, False)
-
# This helper function recursively yields relative pathnames inside a literal
# directory.
import shutil
import sys
import unittest
-import warnings
from test.support import is_wasi, Py_DEBUG
from test.support.os_helper import (TESTFN, skip_unless_symlink,
for it in iters:
self.assertEqual(next(it), p)
- def test_glob0(self):
- with self.assertWarns(DeprecationWarning):
- glob.glob0(self.tempdir, 'a')
-
- with warnings.catch_warnings():
- warnings.simplefilter('ignore')
- eq = self.assertSequencesEqual_noorder
- eq(glob.glob0(self.tempdir, 'a'), ['a'])
- eq(glob.glob0(self.tempdir, '.bb'), ['.bb'])
- eq(glob.glob0(self.tempdir, '.b*'), [])
- eq(glob.glob0(self.tempdir, 'b'), [])
- eq(glob.glob0(self.tempdir, '?'), [])
- eq(glob.glob0(self.tempdir, '*a'), [])
- eq(glob.glob0(self.tempdir, 'a*'), [])
-
- def test_glob1(self):
- with self.assertWarns(DeprecationWarning):
- glob.glob1(self.tempdir, 'a')
-
- with warnings.catch_warnings():
- warnings.simplefilter('ignore')
- eq = self.assertSequencesEqual_noorder
- eq(glob.glob1(self.tempdir, 'a'), ['a'])
- eq(glob.glob1(self.tempdir, '.bb'), ['.bb'])
- eq(glob.glob1(self.tempdir, '.b*'), ['.bb'])
- eq(glob.glob1(self.tempdir, 'b'), [])
- eq(glob.glob1(self.tempdir, '?'), ['a'])
- eq(glob.glob1(self.tempdir, '*a'), ['a', 'aaa'])
- eq(glob.glob1(self.tempdir, 'a*'), ['a', 'aaa', 'aab'])
-
def test_translate_matching(self):
match = re.compile(glob.translate('*')).match
self.assertIsNotNone(match('foo'))