MCPcopy Create free account
hub / github.com/python/cpython / test_glob_directory_with_trailing_slash

Method test_glob_directory_with_trailing_slash

Lib/test/test_glob.py:171–191  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

169 self.norm('aab', 'F')])
170
171 def test_glob_directory_with_trailing_slash(self):
172 seps = (os.sep, os.altsep) if os.altsep else (os.sep,)
173 for sep in seps:
174 # Patterns ending with a slash shouldn't match non-dirs
175 self.assertEqual(glob.glob(self.norm('Z*Z') + sep), [])
176 self.assertEqual(glob.glob(self.norm('ZZZ') + sep), [])
177 self.assertEqual(glob.glob(self.norm('aaa') + sep),
178 [self.norm('aaa') + sep])
179 # Preserving the redundant separators is an implementation detail.
180 self.assertEqual(glob.glob(self.norm('aaa') + sep*2),
181 [self.norm('aaa') + sep*2])
182 # When there is a wildcard pattern which ends with a pathname
183 # separator, glob() doesn't blow.
184 # The result should end with the pathname separator.
185 # Normalizing the trailing separator is an implementation detail.
186 eq = self.assertSequencesEqual_noorder
187 eq(glob.glob(self.norm('aa*') + sep),
188 [self.norm('aaa') + os.sep, self.norm('aab') + os.sep])
189 # Stripping the redundant separators is an implementation detail.
190 eq(glob.glob(self.norm('aa*') + sep*2),
191 [self.norm('aaa') + os.sep, self.norm('aab') + os.sep])
192
193 def test_glob_bytes_directory_with_trailing_slash(self):
194 # Same as test_glob_directory_with_trailing_slash, but with a

Callers

nothing calls this directly

Calls 4

normMethod · 0.95
eqFunction · 0.85
assertEqualMethod · 0.45
globMethod · 0.45

Tested by

no test coverage detected