(self)
| 228 | |
| 229 | class TestInternalCAPI(BaseSetTests, unittest.TestCase): |
| 230 | def test_set_update(self): |
| 231 | update = _testinternalcapi.set_update |
| 232 | for cls in (set, set_subclass): |
| 233 | for it in ('ab', ('a', 'b'), ['a', 'b'], |
| 234 | set('ab'), set_subclass('ab'), |
| 235 | frozenset('ab'), frozenset_subclass('ab')): |
| 236 | with self.subTest(cls=cls, it=it): |
| 237 | instance = cls() |
| 238 | self.assertEqual(update(instance, it), 0) |
| 239 | self.assertEqual(instance, {'a', 'b'}) |
| 240 | instance = cls(it) |
| 241 | self.assertEqual(update(instance, it), 0) |
| 242 | self.assertEqual(instance, {'a', 'b'}) |
| 243 | with self.assertRaisesRegex(TypeError, 'object is not iterable'): |
| 244 | update(cls(), 1) |
| 245 | with self.assertRaisesRegex(TypeError, "unhashable type: 'dict'"): |
| 246 | update(cls(), [{}]) |
| 247 | with self.assertRaises(SystemError): |
| 248 | update(object(), 'ab') |
| 249 | self.assertImmutable(update, 'ab') |
| 250 | # CRASHES: update(NULL, object()) |
| 251 | # CRASHES: update(instance, NULL) |
| 252 | # CRASHES: update(NULL, NULL) |
| 253 | |
| 254 | def test_set_next_entry(self): |
| 255 | set_next = _testinternalcapi.set_next_entry |
nothing calls this directly
no test coverage detected