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

Method test_repr_common

Lib/test/test_pathlib/test_pathlib.py:299–309  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

297 self.assertIsInstance(p, pathlib.PurePosixPath)
298
299 def test_repr_common(self):
300 for pathstr in ('a', 'a/b', 'a/b/c', '/', '/a/b', '/a/b/c'):
301 with self.subTest(pathstr=pathstr):
302 p = self.cls(pathstr)
303 clsname = p.__class__.__name__
304 r = repr(p)
305 # The repr() is in the form ClassName("forward-slashes path").
306 self.assertStartsWith(r, clsname + '(')
307 self.assertEndsWith(r, ')')
308 inner = r[len(clsname) + 1 : -1]
309 self.assertEqual(eval(inner), p.as_posix())
310
311 def test_fspath_common(self):
312 P = self.cls

Callers

nothing calls this directly

Calls 6

assertStartsWithMethod · 0.80
assertEndsWithMethod · 0.80
as_posixMethod · 0.80
subTestMethod · 0.45
clsMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected