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

Method test_bad_pathlike

Lib/test/test_os.py:5446–5455  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

5444 self.assertRaises(TypeError, self.fspath)
5445
5446 def test_bad_pathlike(self):
5447 # __fspath__ returns a value other than str or bytes.
5448 self.assertRaises(TypeError, self.fspath, FakePath(42))
5449 # __fspath__ attribute that is not callable.
5450 c = type('foo', (), {})
5451 c.__fspath__ = 1
5452 self.assertRaises(TypeError, self.fspath, c())
5453 # __fspath__ raises an exception.
5454 self.assertRaises(ZeroDivisionError, self.fspath,
5455 FakePath(ZeroDivisionError()))
5456
5457 def test_pathlike_subclasshook(self):
5458 # bpo-38878: subclasshook causes subclass checks

Callers

nothing calls this directly

Calls 3

FakePathClass · 0.90
cClass · 0.70
assertRaisesMethod · 0.45

Tested by

no test coverage detected