(self)
| 1835 | f'when serializing {REX.__module__}.REX object']) |
| 1836 | |
| 1837 | def test_bad_newobj_args(self): |
| 1838 | obj = REX((copyreg.__newobj__, ())) |
| 1839 | for proto in protocols[2:]: |
| 1840 | with self.subTest(proto=proto): |
| 1841 | with self.assertRaises((IndexError, pickle.PicklingError)) as cm: |
| 1842 | self.dumps(obj, proto) |
| 1843 | self.assertIn(str(cm.exception), { |
| 1844 | 'tuple index out of range', |
| 1845 | '__newobj__ expected at least 1 argument, got 0'}) |
| 1846 | self.assertEqual(cm.exception.__notes__, [ |
| 1847 | f'when serializing {REX.__module__}.REX object']) |
| 1848 | |
| 1849 | obj = REX((copyreg.__newobj__, [REX])) |
| 1850 | for proto in protocols[2:]: |
| 1851 | with self.subTest(proto=proto): |
| 1852 | with self.assertRaises(pickle.PicklingError) as cm: |
| 1853 | self.dumps(obj, proto) |
| 1854 | self.assertEqual(str(cm.exception), |
| 1855 | 'second item of the tuple returned by __reduce__ ' |
| 1856 | 'must be a tuple, not list') |
| 1857 | self.assertEqual(cm.exception.__notes__, [ |
| 1858 | f'when serializing {REX.__module__}.REX object']) |
| 1859 | |
| 1860 | def test_bad_newobj_class(self): |
| 1861 | obj = REX((copyreg.__newobj__, (NoNew(),))) |
nothing calls this directly
no test coverage detected