mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Add docstring and additional test revealing nuances of the implementation as found in setuptools.
This commit is contained in:
parent
2c5278ad30
commit
a2cf2292a2
1 changed files with 16 additions and 0 deletions
|
@ -302,6 +302,11 @@ class FindAllTestCase(unittest.TestCase):
|
||||||
self.assertEqual(filelist.findall(), [])
|
self.assertEqual(filelist.findall(), [])
|
||||||
|
|
||||||
def test_basic_discovery(self):
|
def test_basic_discovery(self):
|
||||||
|
"""
|
||||||
|
When findall is called with no parameters or with
|
||||||
|
'.' as the parameter, the dot should be omitted from
|
||||||
|
the results.
|
||||||
|
"""
|
||||||
with test.support.temp_cwd():
|
with test.support.temp_cwd():
|
||||||
os.mkdir('foo')
|
os.mkdir('foo')
|
||||||
file1 = os.path.join('foo', 'file1.txt')
|
file1 = os.path.join('foo', 'file1.txt')
|
||||||
|
@ -312,6 +317,17 @@ class FindAllTestCase(unittest.TestCase):
|
||||||
expected = [file1, file2]
|
expected = [file1, file2]
|
||||||
self.assertEqual(filelist.findall(), expected)
|
self.assertEqual(filelist.findall(), expected)
|
||||||
|
|
||||||
|
def test_non_local_discovery(self):
|
||||||
|
"""
|
||||||
|
When findall is called with another path, the full
|
||||||
|
path name should be returned.
|
||||||
|
"""
|
||||||
|
with test.support.temp_dir() as temp_dir:
|
||||||
|
file1 = os.path.join(temp_dir, 'file1.txt')
|
||||||
|
test.support.create_empty_file(file1)
|
||||||
|
expected = [file1]
|
||||||
|
self.assertEqual(filelist.findall(temp_dir), expected)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue