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