Coverage for tests/test_tutorial/test_create_db_and_table/test_tutorial001.py: 100%
17 statements
« prev ^ index » next coverage.py v7.17.2, created at 2026-11-16 00:02 +0000
« prev ^ index » next coverage.py v7.17.2, created at 2026-11-16 00:02 +0000
1from pathlib import Path 1nopqrstuvwxyz
3import pytest 1nopqrstuvwxyz
5from ...conftest import coverage_run 1nopqrstuvwxyz
8@pytest.mark.parametrize( 1nopqrstuvwxyz
9 "module_name",
10 [
11 pytest.param("tutorial001"),
12 ],
13)
14def test_create_db_and_table(cov_tmp_path: Path, module_name: str): 1nopqrstuvwxyz
15 module = f"docs_src.tutorial.create_db_and_table.{module_name}" 1abcdefghijklm
16 result = coverage_run(module=module, cwd=cov_tmp_path) 1abcdefghijklm
17 assert "BEGIN" in result.stdout 1abcdefghijklm
18 assert 'PRAGMA main.table_info("hero")' in result.stdout 1abcdefghijklm
19 assert "CREATE TABLE hero (" in result.stdout 1abcdefghijklm
20 assert "id INTEGER NOT NULL," in result.stdout 1abcdefghijklm
21 assert "name VARCHAR NOT NULL," in result.stdout 1abcdefghijklm
22 assert "secret_name VARCHAR NOT NULL," in result.stdout 1abcdefghijklm
23 assert "age INTEGER," in result.stdout 1abcdefghijklm
24 assert "PRIMARY KEY (id)" in result.stdout 1abcdefghijklm
25 assert ")" in result.stdout 1abcdefghijklm
26 assert "COMMIT" in result.stdout 1abcdefghijklm