|
1 | 1 | # Exporter Tests |
2 | 2 |
|
3 | | -[View source code]({{ config.repo_url }}/blob/{{ config.extra.version }}/bindings/python/tests/test_exporter.py){ .md-button } |
| 3 | +[View source code]({{ config.repo_url }}/blob/{{ config.extra.version_tag }}/bindings/python/tests/test_exporter.py){ .md-button } |
4 | 4 |
|
5 | | -These notes mirror the Python tests in [test_exporter.py]({{ config.repo_url }}/blob/{{ config.extra.version }}/bindings/python/tests/test_exporter.py). There are 5 test classes with 12+ tests covering JSONL (with type/edge filters), GraphML/GraphSON (skipped if GraphSON support is unavailable), CSV, round-trip (export→import), bulk insert (chunked transactions), and all data types. |
| 5 | +These notes mirror the Python tests in [test_exporter.py]({{ config.repo_url }}/blob/{{ config.extra.version_tag }}/bindings/python/tests/test_exporter.py). There are 5 test classes with 12+ tests covering JSONL (with type/edge filters), GraphML/GraphSON (skipped if GraphSON support is unavailable), CSV, round-trip (export→import), bulk insert (chunked transactions), and all data types. |
6 | 6 |
|
7 | 7 | ## Test Classes & Cases |
8 | 8 |
|
9 | 9 | ### TestDatabaseExport |
10 | 10 |
|
11 | 11 | Fixture `sample_db` creates 20 users, 15 movies, 10 actors, 50 Rated edges, 30 ActedIn edges, 15 Follows edges, 10 LogEntry docs, 5 Config docs (155 total records). |
12 | 12 |
|
13 | | -- **export_jsonl_basic**: Exports entire database; asserts `totalRecords == 155`, `vertices == 45` (20+15+10), `edges == 95` (50+30+15), `documents == 15` (10+5). File in `exports/` dir. See [test_exporter.py#L226-L247]({{ config.repo_url }}/blob/{{ config.extra.version }}/bindings/python/tests/test_exporter.py#L226-L247). |
| 13 | +- **export_jsonl_basic**: Exports entire database; asserts `totalRecords == 155`, `vertices == 45` (20+15+10), `edges == 95` (50+30+15), `documents == 15` (10+5). File in `exports/` dir. See [test_exporter.py#L226-L247]({{ config.repo_url }}/blob/{{ config.extra.version_tag }}/bindings/python/tests/test_exporter.py#L226-L247). |
14 | 14 |
|
15 | | -- **export_jsonl_with_include_types**: Exports only `User` type; asserts `vertices == 20`, edges/docs zero. See [test_exporter.py#L249-L265]({{ config.repo_url }}/blob/{{ config.extra.version }}/bindings/python/tests/test_exporter.py#L249-L265). |
| 15 | +- **export_jsonl_with_include_types**: Exports only `User` type; asserts `vertices == 20`, edges/docs zero. See [test_exporter.py#L249-L265]({{ config.repo_url }}/blob/{{ config.extra.version_tag }}/bindings/python/tests/test_exporter.py#L249-L265). |
16 | 16 |
|
17 | | -- **export_jsonl_with_exclude_types**: Excludes `LogEntry`; asserts `documents == 5` (only Config, logs excluded). See [test_exporter.py#L267-L282]({{ config.repo_url }}/blob/{{ config.extra.version }}/bindings/python/tests/test_exporter.py#L267-L282). |
| 17 | +- **export_jsonl_with_exclude_types**: Excludes `LogEntry`; asserts `documents == 5` (only Config, logs excluded). See [test_exporter.py#L267-L282]({{ config.repo_url }}/blob/{{ config.extra.version_tag }}/bindings/python/tests/test_exporter.py#L267-L282). |
18 | 18 |
|
19 | | -- **export_overwrite_protection**: First export succeeds; second with `overwrite=False` raises `ArcadeDBError` mentioning "already exists" or "overwrite". See [test_exporter.py#L284-L304]({{ config.repo_url }}/blob/{{ config.extra.version }}/bindings/python/tests/test_exporter.py#L284-L304). |
| 19 | +- **export_overwrite_protection**: First export succeeds; second with `overwrite=False` raises `ArcadeDBError` mentioning "already exists" or "overwrite". See [test_exporter.py#L284-L304]({{ config.repo_url }}/blob/{{ config.extra.version_tag }}/bindings/python/tests/test_exporter.py#L284-L304). |
20 | 20 |
|
21 | | -- **export_invalid_format**: Passes `format="invalid_format"`; asserts raises `ArcadeDBError` with "invalid" or "format". See [test_exporter.py#L306-L312]({{ config.repo_url }}/blob/{{ config.extra.version }}/bindings/python/tests/test_exporter.py#L306-L312). |
| 21 | +- **export_invalid_format**: Passes `format="invalid_format"`; asserts raises `ArcadeDBError` with "invalid" or "format". See [test_exporter.py#L306-L312]({{ config.repo_url }}/blob/{{ config.extra.version_tag }}/bindings/python/tests/test_exporter.py#L306-L312). |
22 | 22 |
|
23 | | -- **export_graphml/export_graphson**: Both attempt export; if GraphSON support is missing, skip with `pytest.skip(...)`. See [test_exporter.py#L314-L357]({{ config.repo_url }}/blob/{{ config.extra.version }}/bindings/python/tests/test_exporter.py#L314-L357). |
| 23 | +- **export_graphml/export_graphson**: Both attempt export; if GraphSON support is missing, skip with `pytest.skip(...)`. See [test_exporter.py#L314-L357]({{ config.repo_url }}/blob/{{ config.extra.version_tag }}/bindings/python/tests/test_exporter.py#L314-L357). |
24 | 24 |
|
25 | | -- **export_verbose_levels**: Tests `verbose` parameter (0, 1, 2); asserts `"totalRecords"` in stats for each. See [test_exporter.py#L359-L373]({{ config.repo_url }}/blob/{{ config.extra.version }}/bindings/python/tests/test_exporter.py#L359-L373). |
| 25 | +- **export_verbose_levels**: Tests `verbose` parameter (0, 1, 2); asserts `"totalRecords"` in stats for each. See [test_exporter.py#L359-L373]({{ config.repo_url }}/blob/{{ config.extra.version_tag }}/bindings/python/tests/test_exporter.py#L359-L373). |
26 | 26 |
|
27 | | -- **export_empty_database**: Empty database exports with `totalRecords == 0`, `vertices/edges/documents == 0`. File still created. See [test_exporter.py#L375-L396]({{ config.repo_url }}/blob/{{ config.extra.version }}/bindings/python/tests/test_exporter.py#L375-L396). |
| 27 | +- **export_empty_database**: Empty database exports with `totalRecords == 0`, `vertices/edges/documents == 0`. File still created. See [test_exporter.py#L375-L396]({{ config.repo_url }}/blob/{{ config.extra.version_tag }}/bindings/python/tests/test_exporter.py#L375-L396). |
28 | 28 |
|
29 | 29 | ### TestCSVExport |
30 | 30 |
|
31 | | -- **export_to_csv_basic**: Queries 20 User records; asserts CSV has 20 rows with columns `userId, name, age, email, premium`. See [test_exporter.py#L400-L426]({{ config.repo_url }}/blob/{{ config.extra.version }}/bindings/python/tests/test_exporter.py#L400-L426). |
| 31 | +- **export_to_csv_basic**: Queries 20 User records; asserts CSV has 20 rows with columns `userId, name, age, email, premium`. See [test_exporter.py#L400-L426]({{ config.repo_url }}/blob/{{ config.extra.version_tag }}/bindings/python/tests/test_exporter.py#L400-L426). |
32 | 32 |
|
33 | | -- **export_to_csv_with_fieldnames**: Exports Movie query with custom fieldnames `["movieId", "title"]`; asserts header and column count. See [test_exporter.py#L428-L451]({{ config.repo_url }}/blob/{{ config.extra.version }}/bindings/python/tests/test_exporter.py#L428-L451). |
| 33 | +- **export_to_csv_with_fieldnames**: Exports Movie query with custom fieldnames `["movieId", "title"]`; asserts header and column count. See [test_exporter.py#L428-L451]({{ config.repo_url }}/blob/{{ config.extra.version_tag }}/bindings/python/tests/test_exporter.py#L428-L451). |
34 | 34 |
|
35 | | -- **export_to_csv_empty_results**: Query with no hits; asserts CSV exists and is mostly empty (headers only or zero rows). See [test_exporter.py#L453-L464]({{ config.repo_url }}/blob/{{ config.extra.version }}/bindings/python/tests/test_exporter.py#L453-L464). |
| 35 | +- **export_to_csv_empty_results**: Query with no hits; asserts CSV exists and is mostly empty (headers only or zero rows). See [test_exporter.py#L453-L464]({{ config.repo_url }}/blob/{{ config.extra.version_tag }}/bindings/python/tests/test_exporter.py#L453-L464). |
36 | 36 |
|
37 | | -- **export_to_csv_with_resultset**: Uses `export_to_csv(results, path)` on `SELECT rating FROM Rated WHERE rating > 0`; asserts 50 rows (all Rated edges). See [test_exporter.py#L466-L481]({{ config.repo_url }}/blob/{{ config.extra.version }}/bindings/python/tests/test_exporter.py#L466-L481). |
| 37 | +- **export_to_csv_with_resultset**: Uses `export_to_csv(results, path)` on `SELECT rating FROM Rated WHERE rating > 0`; asserts 50 rows (all Rated edges). See [test_exporter.py#L466-L481]({{ config.repo_url }}/blob/{{ config.extra.version_tag }}/bindings/python/tests/test_exporter.py#L466-L481). |
38 | 38 |
|
39 | | -- **export_to_csv_with_list_of_dicts**: Passes list of 3 dicts to `export_to_csv()`, verifies CSV written and matches. See [test_exporter.py#L483-L506]({{ config.repo_url }}/blob/{{ config.extra.version }}/bindings/python/tests/test_exporter.py#L483-L506). |
| 39 | +- **export_to_csv_with_list_of_dicts**: Passes list of 3 dicts to `export_to_csv()`, verifies CSV written and matches. See [test_exporter.py#L483-L506]({{ config.repo_url }}/blob/{{ config.extra.version_tag }}/bindings/python/tests/test_exporter.py#L483-L506). |
40 | 40 |
|
41 | 41 | ### TestRoundTripExport |
42 | 42 |
|
43 | | -- **jsonl_export_import_roundtrip**: Exports sample_db to JSONL, closes original, creates new DB, imports via `IMPORT DATABASE file://...`, then verifies counts (User 20, Movie 15, Actor 10, LogEntry 10, Config 5) and data integrity (first user name is "User0"). See [test_exporter.py#L508-L567]({{ config.repo_url }}/blob/{{ config.extra.version }}/bindings/python/tests/test_exporter.py#L508-L567). |
| 43 | +- **jsonl_export_import_roundtrip**: Exports sample_db to JSONL, closes original, creates new DB, imports via `IMPORT DATABASE file://...`, then verifies counts (User 20, Movie 15, Actor 10, LogEntry 10, Config 5) and data integrity (first user name is "User0"). See [test_exporter.py#L508-L567]({{ config.repo_url }}/blob/{{ config.extra.version_tag }}/bindings/python/tests/test_exporter.py#L508-L567). |
44 | 44 |
|
45 | 45 | ### TestExportWithBulkInsert |
46 | 46 |
|
47 | | -- **export_after_chunked_insert**: Uses chunked transactions (no `batch_context`) to create 500 Product vertices, exports to JSONL, asserts `vertices == 500`. See [test_exporter.py#L567-L605]({{ config.repo_url }}/blob/{{ config.extra.version }}/bindings/python/tests/test_exporter.py#L567-L605). |
| 47 | +- **export_after_chunked_insert**: Uses chunked transactions (no `batch_context`) to create 500 Product vertices, exports to JSONL, asserts `vertices == 500`. See [test_exporter.py#L567-L605]({{ config.repo_url }}/blob/{{ config.extra.version_tag }}/bindings/python/tests/test_exporter.py#L567-L605). |
48 | 48 |
|
49 | 49 | ### TestAllDataTypes |
50 | 50 |
|
|
0 commit comments