Skip to content

Commit b3df197

Browse files
committed
Test SQL profile capability preflight
1 parent 731db1e commit b3df197

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

‎tests/test_sql_profiles.py‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import pytest
2+
3+
from openstatspec.core import UnsupportedOperationError
4+
from openstatspec.sql.profiles import MYSQL, POSTGRESQL, SQLITE, preflight, profile_for_url
5+
6+
7+
def test_profile_detection_tracks_supported_dialect_urls() -> None:
8+
assert profile_for_url("sqlite:///dataset.sqlite") is SQLITE
9+
assert profile_for_url("postgresql+psycopg://user@host/database") is POSTGRESQL
10+
assert profile_for_url("mysql+pymysql://user@host/database") is MYSQL
11+
assert profile_for_url("mariadb+mariadbconnector://user@host/database") is MYSQL
12+
13+
14+
def test_profile_preflight_fails_without_transforming_a_wide_dataset() -> None:
15+
with pytest.raises(UnsupportedOperationError, match="Target capability exceeded"):
16+
preflight(POSTGRESQL, POSTGRESQL.max_physical_variables + 1)
17+
18+
19+
def test_unknown_target_is_explicitly_rejected() -> None:
20+
with pytest.raises(UnsupportedOperationError, match="No OpenStatSpec SQL profile"):
21+
profile_for_url("oracle://host/database")

0 commit comments

Comments
 (0)