| 42 | |
| 43 | |
| 44 | class SaveAndFind(threading.Thread): |
| 45 | def __init__(self, collection): |
| 46 | threading.Thread.__init__(self) |
| 47 | self.collection = collection |
| 48 | self.daemon = True |
| 49 | self.passed = False |
| 50 | |
| 51 | def run(self): |
| 52 | sum = 0 |
| 53 | for document in self.collection.find(): |
| 54 | sum += document["x"] |
| 55 | |
| 56 | assert sum == 499500, "sum was %d not 499500" % sum |
| 57 | self.passed = True |
| 58 | |
| 59 | |
| 60 | class Insert(threading.Thread): |