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

Method test_equivalences

Lib/test/test_pathlib/test_pathlib.py:377–395  ·  view source on GitHub ↗
(self, equivalences=None)

Source from the content-addressed store, hash-verified

375 self.assertNotEqual(P(), int)
376
377 def test_equivalences(self, equivalences=None):
378 if equivalences is None:
379 equivalences = self.equivalences
380 for k, tuples in equivalences.items():
381 canon = k.replace('/', self.sep)
382 posix = k.replace(self.sep, '/')
383 if canon != posix:
384 tuples = tuples + [
385 tuple(part.replace('/', self.sep) for part in t)
386 for t in tuples
387 ]
388 tuples.append((posix, ))
389 pcanon = self.cls(canon)
390 for t in tuples:
391 p = self.cls(*t)
392 self.assertEqual(p, pcanon, "failed with args {}".format(t))
393 self.assertEqual(hash(p), hash(pcanon))
394 self.assertEqual(str(p), canon)
395 self.assertEqual(p.as_posix(), posix)
396
397 def test_ordering_common(self):
398 # Ordering is tuple-alike.

Callers 1

Calls 8

strFunction · 0.85
as_posixMethod · 0.80
itemsMethod · 0.45
replaceMethod · 0.45
appendMethod · 0.45
clsMethod · 0.45
assertEqualMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected