diff options
author | Barney Gale <barney.gale@gmail.com> | 2024-04-01 19:37:41 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-01 19:37:41 (GMT) |
commit | fc8007ee3635db6ab73e132ebff987c910b6d538 (patch) | |
tree | d05976e835762f6dba3c81b60cf0f5a9c445aae0 /Lib/test/test_glob.py | |
parent | c741ad3537193c63fe697a8f0316aecd45eeb9ba (diff) | |
download | cpython-fc8007ee3635db6ab73e132ebff987c910b6d538.zip cpython-fc8007ee3635db6ab73e132ebff987c910b6d538.tar.gz cpython-fc8007ee3635db6ab73e132ebff987c910b6d538.tar.bz2 |
GH-117337: Deprecate `glob.glob0()` and `glob.glob1()`. (#117371)
These undocumented functions are no longer used by `msilib`, so there's no
reason to keep them around.
Diffstat (limited to 'Lib/test/test_glob.py')
-rw-r--r-- | Lib/test/test_glob.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Lib/test/test_glob.py b/Lib/test/test_glob.py index 6719bdb..70ee35e 100644 --- a/Lib/test/test_glob.py +++ b/Lib/test/test_glob.py @@ -4,6 +4,7 @@ import re import shutil import sys import unittest +import warnings from test.support.os_helper import (TESTFN, skip_unless_symlink, can_symlink, create_empty_file, change_cwd) @@ -382,6 +383,36 @@ class GlobTests(unittest.TestCase): 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')) |