MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_equivalences

Method test_equivalences

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

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 9

hashFunction · 0.85
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