(self)
| 5473 | self.assertNotHasAttr(A(), '__dict__') |
| 5474 | |
| 5475 | def test_fspath_set_to_None(self): |
| 5476 | class Foo: |
| 5477 | __fspath__ = None |
| 5478 | |
| 5479 | class Bar: |
| 5480 | def __fspath__(self): |
| 5481 | return 'bar' |
| 5482 | |
| 5483 | class Baz(Bar): |
| 5484 | __fspath__ = None |
| 5485 | |
| 5486 | good_error_msg = ( |
| 5487 | r"expected str, bytes or os.PathLike object, not {}".format |
| 5488 | ) |
| 5489 | |
| 5490 | with self.assertRaisesRegex(TypeError, good_error_msg("Foo")): |
| 5491 | self.fspath(Foo()) |
| 5492 | |
| 5493 | self.assertEqual(self.fspath(Bar()), 'bar') |
| 5494 | |
| 5495 | with self.assertRaisesRegex(TypeError, good_error_msg("Baz")): |
| 5496 | self.fspath(Baz()) |
| 5497 | |
| 5498 | with self.assertRaisesRegex(TypeError, good_error_msg("Foo")): |
| 5499 | open(Foo()) |
| 5500 | |
| 5501 | with self.assertRaisesRegex(TypeError, good_error_msg("Baz")): |
| 5502 | open(Baz()) |
| 5503 | |
| 5504 | other_good_error_msg = ( |
| 5505 | r"should be string, bytes or os.PathLike, not {}".format |
| 5506 | ) |
| 5507 | |
| 5508 | with self.assertRaisesRegex(TypeError, other_good_error_msg("Foo")): |
| 5509 | os.rename(Foo(), "foooo") |
| 5510 | |
| 5511 | with self.assertRaisesRegex(TypeError, other_good_error_msg("Baz")): |
| 5512 | os.rename(Baz(), "bazzz") |
| 5513 | |
| 5514 | class TimesTests(unittest.TestCase): |
| 5515 | def test_times(self): |
nothing calls this directly
no test coverage detected