(self)
| 1152 | self.assertIn("mike", db.test.find_one(projection={"x": 0})) |
| 1153 | |
| 1154 | def test_find_w_regex(self): |
| 1155 | db = self.db |
| 1156 | db.test.delete_many({}) |
| 1157 | |
| 1158 | db.test.insert_one({"x": "hello_world"}) |
| 1159 | db.test.insert_one({"x": "hello_mike"}) |
| 1160 | db.test.insert_one({"x": "hello_mikey"}) |
| 1161 | db.test.insert_one({"x": "hello_test"}) |
| 1162 | |
| 1163 | self.assertEqual(len(db.test.find().to_list()), 4) |
| 1164 | self.assertEqual(len(db.test.find({"x": re.compile("^hello.*")}).to_list()), 4) |
| 1165 | self.assertEqual(len(db.test.find({"x": re.compile("ello")}).to_list()), 4) |
| 1166 | self.assertEqual(len(db.test.find({"x": re.compile("^hello$")}).to_list()), 0) |
| 1167 | self.assertEqual(len(db.test.find({"x": re.compile("^hello_mi.*$")}).to_list()), 2) |
| 1168 | |
| 1169 | def test_id_can_be_anything(self): |
| 1170 | db = self.db |
nothing calls this directly
no test coverage detected