(self)
| 4421 | self.assertNotIsInstance(A(), CustomReader) |
| 4422 | |
| 4423 | def test_io_writer_protocol_allowed(self): |
| 4424 | @runtime_checkable |
| 4425 | class CustomWriter(io.Writer[bytes], Protocol): |
| 4426 | def close(self): ... |
| 4427 | |
| 4428 | class A: pass |
| 4429 | class B: |
| 4430 | def write(self, b): |
| 4431 | pass |
| 4432 | def close(self): |
| 4433 | pass |
| 4434 | |
| 4435 | self.assertIsSubclass(B, CustomWriter) |
| 4436 | self.assertIsInstance(B(), CustomWriter) |
| 4437 | self.assertNotIsSubclass(A, CustomWriter) |
| 4438 | self.assertNotIsInstance(A(), CustomWriter) |
| 4439 | |
| 4440 | def test_builtin_protocol_allowlist(self): |
| 4441 | with self.assertRaises(TypeError): |
nothing calls this directly
no test coverage detected