MCPcopy Index your code
hub / github.com/python/cpython / test_recurse

Method test_recurse

Lib/idlelib/idle_test/test_grep.py:89–115  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

87 self.assertNotIn(self.realpath, filelist)
88
89 def test_recurse(self):
90 ff = grep.findfiles
91 parent = os.path.dirname(self.path)
92 grepfile = os.path.join(parent, 'grep.py')
93 pat = '*.py'
94
95 # Get Python files only in parent directory.
96 filelist = list(ff(parent, pat, False))
97 parent_size = len(filelist)
98 # Lots of Python files in idlelib.
99 self.assertGreater(parent_size, 20)
100 self.assertIn(grepfile, filelist)
101 # Without subdirectories, this file isn't returned.
102 self.assertNotIn(self.realpath, filelist)
103
104 # Include subdirectories.
105 filelist = list(ff(parent, pat, True))
106 # More files found now.
107 self.assertGreater(len(filelist), parent_size)
108 self.assertIn(grepfile, filelist)
109 # This file exists in list now.
110 self.assertIn(self.realpath, filelist)
111
112 # Check another level up the tree.
113 parent = os.path.dirname(parent)
114 filelist = list(ff(parent, '*.py', True))
115 self.assertIn(self.realpath, filelist)
116
117
118class Grep_itTest(unittest.TestCase):

Callers

nothing calls this directly

Calls 7

listClass · 0.85
ffFunction · 0.85
assertGreaterMethod · 0.80
assertInMethod · 0.80
assertNotInMethod · 0.80
dirnameMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected