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

Method test_with_stem

Lib/test/test_pathlib/test_join.py:337–350  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

335 self.assertRaises(ValueError, P('a/b').with_name, 'c/d')
336
337 def test_with_stem(self):
338 P = self.cls
339 self.assertEqual(P('a/b').with_stem('d'), P('a/d'))
340 self.assertEqual(P('/a/b').with_stem('d'), P('/a/d'))
341 self.assertEqual(P('a/b.py').with_stem('d'), P('a/d.py'))
342 self.assertEqual(P('/a/b.py').with_stem('d'), P('/a/d.py'))
343 self.assertEqual(P('/a/b.tar.gz').with_stem('d'), P('/a/d.gz'))
344 self.assertEqual(P('a/Dot ending.').with_stem('d'), P('a/d.'))
345 self.assertEqual(P('/a/Dot ending.').with_stem('d'), P('/a/d.'))
346 self.assertRaises(ValueError, P('foo.gz').with_stem, '')
347 self.assertRaises(ValueError, P('/a/b/foo.gz').with_stem, '')
348 self.assertRaises(ValueError, P('a/b').with_stem, '/c')
349 self.assertRaises(ValueError, P('a/b').with_stem, 'c/')
350 self.assertRaises(ValueError, P('a/b').with_stem, 'c/d')
351
352 def test_with_suffix(self):
353 P = self.cls

Callers

nothing calls this directly

Calls 4

PClass · 0.70
assertEqualMethod · 0.45
with_stemMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected