| | 1334 | def test_lazydocument(): |
| | 1335 | """Test the lazy document loading and modification code. |
| | 1336 | |
| | 1337 | """ |
| | 1338 | dbpath = 'db_test_lazydocument' |
| | 1339 | db=xapian.WritableDatabase(dbpath, xapian.DB_CREATE_OR_OVERWRITE) |
| | 1340 | db.add_document(xapian.Document()) |
| | 1341 | doc1=db.get_document(1) |
| | 1342 | doc2=db.get_document(1) |
| | 1343 | doc1.add_term('foo') |
| | 1344 | db.replace_document(1, doc1) |
| | 1345 | expect([t.term for t in db.get_document(1).termlist()], ['foo']) |
| | 1346 | db.replace_document(1, doc2) |
| | 1347 | expect([t.term for t in db.get_document(1).termlist()], []) |
| | 1348 | |