sqlite-utils/tests
Claude 45af93d463
db.query() now executes its SQL immediately
Previously query() was a generator function, so nothing - including
the SQL itself - ran until the result was first iterated. A write
statement passed to query() silently did nothing, and SQL errors
surfaced far from the call site. The SQL now executes as soon as
query() is called, while rows are still fetched lazily during
iteration.

Statements that return no rows now raise a ValueError directing
callers to execute() instead. As a side effect, statements like
INSERT ... RETURNING now work naturally with query().

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UnLnhsH25Nnv7LHhekUfPd
2026-07-04 18:24:52 +00:00
..
sniff sqlite-utils insert --sniff option, closes #230 2021-02-14 11:23:12 -08:00
__init__.py Initial project layout + database table creation tools 2018-07-28 06:46:17 -07:00
conftest.py Test against Python 3.15-dev, bump ty and Black (#738) 2026-05-17 16:52:48 -07:00
ext.c Support entrypoints for --load-extension (#473) 2022-08-26 22:55:47 -07:00
test_analyze.py Use sqlean if available in environment (#560) 2023-06-25 16:25:51 -07:00
test_analyze_tables.py Test against Python 3.15-dev, bump ty and Black (#738) 2026-05-17 16:52:48 -07:00
test_atomic.py db.atomic() method 2026-06-21 10:43:19 -07:00
test_attach.py db.attach(alias, filepath) method, closes #113 2021-02-18 20:56:32 -08:00
test_cli.py drop-table and drop-view now refuse to drop the wrong object type 2026-07-04 18:13:50 +00:00
test_cli_bulk.py --functions can take filenames, can be used multiple times (#681) 2025-11-23 21:46:51 -08:00
test_cli_convert.py Test against Python 3.15-dev, bump ty and Black (#738) 2026-05-17 16:52:48 -07:00
test_cli_insert.py Fix issue #702: Handle CSV with only header row in --detect-types (#707) 2026-06-21 15:57:06 -07:00
test_cli_memory.py Test for CSV headers with memory command, refs #702, #707 2026-06-21 16:05:10 -07:00
test_cli_migrate.py New migrations system, ported from sqlite-migrate (#754) 2026-06-21 09:40:21 -07:00
test_column_affinity.py Tracer mechanism for showing underlying SQL queries 2020-09-07 14:56:59 -07:00
test_constructor.py db.close() method, closes #504 2022-10-25 13:57:43 -07:00
test_conversions.py Now complies with flake8, refs #291 2021-06-22 18:22:08 -07:00
test_convert.py Removed convert skip_false and --skip-false, closes #542 2025-11-23 15:40:28 -08:00
test_create.py Test against Python 3.15-dev, bump ty and Black (#738) 2026-05-17 16:52:48 -07:00
test_create_view.py Tracer mechanism for showing underlying SQL queries 2020-09-07 14:56:59 -07:00
test_default_value.py Handle db.table(table_name).insert({}), closes #759 2026-06-22 12:00:05 -07:00
test_delete.py Fix delete_where() leaving the connection in an open transaction 2026-07-04 17:57:35 +00:00
test_docs.py More type annotations (#697) 2025-12-16 22:11:47 -08:00
test_duplicate.py Test against Python 3.15-dev, bump ty and Black (#738) 2026-05-17 16:52:48 -07:00
test_enable_counts.py Use double quotes not braces for tables and columns (#678) 2025-11-23 20:43:26 -08:00
test_extract.py Test against Python 3.15-dev, bump ty and Black (#738) 2026-05-17 16:52:48 -07:00
test_extracts.py Use double quotes not braces for tables and columns (#678) 2025-11-23 20:43:26 -08:00
test_fts.py Fix for detect_fts failing on [], refs #694 2026-06-21 15:54:19 -07:00
test_get.py Refactored tests into new test_rows.py, refs #76 2020-04-15 18:04:55 -07:00
test_gis.py Type fixes now enforced by ty 2025-12-16 19:34:45 -08:00
test_hypothesis.py Now complies with flake8, refs #291 2021-06-22 18:22:08 -07:00
test_insert_files.py insert-files multiple --pk support, closes #621 2024-03-16 17:33:31 -07:00
test_introspect.py Test against Python 3.15-dev, bump ty and Black (#738) 2026-05-17 16:52:48 -07:00
test_list_mode.py table.insert_all() and table.upsert_all() now take generators of lists/tuples 2025-11-23 12:17:23 -08:00
test_lookup.py Use double quotes not braces for tables and columns (#678) 2025-11-23 20:43:26 -08:00
test_m2m.py Swapped the order of a bunch of pytest comparisons 2023-08-17 18:05:13 -07:00
test_migrations.py Run each migration inside a transaction 2026-07-04 18:06:06 +00:00
test_plugins.py fix: Plugins are still loaded when running tests (#719) 2026-06-21 16:14:45 -07:00
test_query.py db.query() now executes its SQL immediately 2026-07-04 18:24:52 +00:00
test_recipes.py table.insert_all() and table.upsert_all() now take generators of lists/tuples 2025-11-23 12:17:23 -08:00
test_recreate.py Database as a context manager, fixed many pytest warnings 2025-12-11 16:56:12 -08:00
test_register_function.py Database as a context manager, fixed many pytest warnings 2025-12-11 16:56:12 -08:00
test_rows.py Now complies with flake8, refs #291 2021-06-22 18:22:08 -07:00
test_rows_from_file.py Type fixes now enforced by ty 2025-12-16 19:34:45 -08:00
test_sniff.py Detect CSV/TSV column types by default (#683) 2025-11-23 22:23:15 -08:00
test_suggest_column_types.py Fixed bug with null columns, closes #95 2020-03-23 13:31:06 -07:00
test_tracer.py Fix broken tracer test 2026-06-21 16:29:32 -07:00
test_transform.py Test against Python 3.15-dev, bump ty and Black (#738) 2026-05-17 16:52:48 -07:00
test_update.py Use double quotes not braces for tables and columns (#678) 2025-11-23 20:43:26 -08:00
test_upsert.py upsert() detects existing compound primary keys 2026-06-24 10:43:53 -07:00
test_utils.py sqlite_utils.utils.flatten() function, closes #500 2022-10-18 11:00:35 -07:00
test_wal.py Now complies with flake8, refs #291 2021-06-22 18:22:08 -07:00