(self)
| 3727 | pass |
| 3728 | |
| 3729 | def test_str_of_str_subclass(self): |
| 3730 | # Testing __str__ defined in subclass of str ... |
| 3731 | import binascii |
| 3732 | |
| 3733 | class octetstring(str): |
| 3734 | def __str__(self): |
| 3735 | return binascii.b2a_hex(self.encode('ascii')).decode("ascii") |
| 3736 | def __repr__(self): |
| 3737 | return self + " repr" |
| 3738 | |
| 3739 | o = octetstring('A') |
| 3740 | self.assertEqual(type(o), octetstring) |
| 3741 | self.assertEqual(type(str(o)), str) |
| 3742 | self.assertEqual(type(repr(o)), str) |
| 3743 | self.assertEqual(ord(o), 0x41) |
| 3744 | self.assertEqual(str(o), '41') |
| 3745 | self.assertEqual(repr(o), 'A repr') |
| 3746 | self.assertEqual(o.__str__(), '41') |
| 3747 | self.assertEqual(o.__repr__(), 'A repr') |
| 3748 | |
| 3749 | def test_repr_with_module_str_subclass(self): |
| 3750 | # gh-98783 |
nothing calls this directly
no test coverage detected