| 736 | raise NotImplementedError() |
| 737 | |
| 738 | def test_mask(self: typing.Any): |
| 739 | self.assertEqual(self.mask(b"abcd", b""), b"") |
| 740 | self.assertEqual(self.mask(b"abcd", b"b"), b"\x03") |
| 741 | self.assertEqual(self.mask(b"abcd", b"54321"), b"TVPVP") |
| 742 | self.assertEqual(self.mask(b"ZXCV", b"98765432"), b"c`t`olpd") |
| 743 | # Include test cases with \x00 bytes (to ensure that the C |
| 744 | # extension isn't depending on null-terminated strings) and |
| 745 | # bytes with the high bit set (to smoke out signedness issues). |
| 746 | self.assertEqual( |
| 747 | self.mask(b"\x00\x01\x02\x03", b"\xff\xfb\xfd\xfc\xfe\xfa"), |
| 748 | b"\xff\xfa\xff\xff\xfe\xfb", |
| 749 | ) |
| 750 | self.assertEqual( |
| 751 | self.mask(b"\xff\xfb\xfd\xfc", b"\x00\x01\x02\x03\x04\x05"), |
| 752 | b"\xff\xfa\xff\xff\xfb\xfe", |
| 753 | ) |
| 754 | |
| 755 | |
| 756 | class PythonMaskFunctionTest(MaskFunctionMixin, unittest.TestCase): |