|
1 | 1 | import pytest |
2 | 2 |
|
3 | 3 | from arango.exceptions import ( |
4 | | - CursorCloseError, |
5 | | - CursorNextError, |
6 | 4 | DocumentCountError, |
7 | 5 | DocumentDeleteError, |
8 | 6 | DocumentGetError, |
@@ -1676,76 +1674,6 @@ def test_document_keys(col, bad_col, docs): |
1676 | 1674 | assert err.value.error_code in {11, 1228} |
1677 | 1675 |
|
1678 | 1676 |
|
1679 | | -def test_document_export(col, bad_col, docs, cluster): |
1680 | | - if cluster: |
1681 | | - pytest.skip("Not tested in a cluster setup") |
1682 | | - |
1683 | | - # Set up test documents |
1684 | | - col.insert_many(docs) |
1685 | | - |
1686 | | - # Test export with flush set to True and flush_wait set to 1 |
1687 | | - cursor = col.export(flush=True, flush_wait=1) |
1688 | | - assert clean_doc(cursor) == docs |
1689 | | - assert cursor.type == "export" |
1690 | | - |
1691 | | - # Test export with count |
1692 | | - cursor = col.export(flush=False, count=True) |
1693 | | - assert cursor.count() == len(docs) |
1694 | | - assert clean_doc(cursor) == docs |
1695 | | - |
1696 | | - # Test export with batch size |
1697 | | - cursor = col.export(flush=False, count=True, batch_size=1) |
1698 | | - assert cursor.count() == len(docs) |
1699 | | - assert clean_doc(cursor) == docs |
1700 | | - |
1701 | | - # Test export with time-to-live |
1702 | | - cursor = col.export(flush=False, count=True, ttl=10) |
1703 | | - assert cursor.count() == len(docs) |
1704 | | - assert clean_doc(cursor) == docs |
1705 | | - |
1706 | | - # Test export with filters |
1707 | | - cursor = col.export( |
1708 | | - count=True, flush=False, filter_fields=["text"], filter_type="exclude" |
1709 | | - ) |
1710 | | - assert cursor.count() == len(docs) |
1711 | | - assert all(["text" not in d for d in cursor]) |
1712 | | - |
1713 | | - # Test export with a limit of 0 |
1714 | | - cursor = col.export(flush=False, count=True, limit=0) |
1715 | | - assert cursor.count() == 0 |
1716 | | - assert clean_doc(cursor) == [] |
1717 | | - |
1718 | | - # Test export with a limit of 1 |
1719 | | - cursor = col.export(flush=False, count=True, limit=1) |
1720 | | - assert cursor.count() == 1 |
1721 | | - assert len(list(cursor)) == 1 |
1722 | | - all([clean_doc(d) in docs for d in cursor]) |
1723 | | - |
1724 | | - # Test export with a limit of 3 |
1725 | | - cursor = col.export(flush=False, count=True, limit=3) |
1726 | | - assert cursor.count() == 3 |
1727 | | - assert len(list(cursor)) == 3 |
1728 | | - all([clean_doc(d) in docs for d in cursor]) |
1729 | | - |
1730 | | - # Test export with bad database |
1731 | | - with assert_raises(DocumentGetError): |
1732 | | - bad_col.export() |
1733 | | - |
1734 | | - # Test closing export cursor |
1735 | | - cursor = col.export(flush=False, count=True, batch_size=1) |
1736 | | - assert cursor.close(ignore_missing=False) is True |
1737 | | - assert cursor.close(ignore_missing=True) is False |
1738 | | - |
1739 | | - assert clean_doc(cursor.next()) in docs |
1740 | | - with assert_raises(CursorNextError): |
1741 | | - cursor.next() |
1742 | | - with assert_raises(CursorCloseError): |
1743 | | - cursor.close(ignore_missing=False) |
1744 | | - |
1745 | | - cursor = col.export(flush=False, count=True) |
1746 | | - assert cursor.close(ignore_missing=True) is None |
1747 | | - |
1748 | | - |
1749 | 1677 | def test_document_random(col, bad_col, docs): |
1750 | 1678 | # Set up test documents |
1751 | 1679 | col.import_bulk(docs) |
|
0 commit comments