| 236 | self.assertIn("has no attribute '_does_not_exist'", str(context.exception)) |
| 237 | |
| 238 | def test_iteration(self): |
| 239 | client = self.client |
| 240 | msg = "'MongoClient' object is not iterable" |
| 241 | # Iteration fails |
| 242 | with self.assertRaisesRegex(TypeError, msg): |
| 243 | for _ in client: # type: ignore[misc] # error: "None" not callable [misc] |
| 244 | break |
| 245 | # Index fails |
| 246 | with self.assertRaises(TypeError): |
| 247 | _ = client[0] |
| 248 | # next fails |
| 249 | with self.assertRaisesRegex(TypeError, "'MongoClient' object is not iterable"): |
| 250 | _ = next(client) |
| 251 | # .next() fails |
| 252 | with self.assertRaisesRegex(TypeError, "'MongoClient' object is not iterable"): |
| 253 | _ = client.next() |
| 254 | # Do not implement typing.Iterable. |
| 255 | self.assertNotIsInstance(client, Iterable) |
| 256 | |
| 257 | def test_get_default_database(self): |
| 258 | c = self.rs_or_single_client( |