Skip to content

Commit a03f60a

Browse files
Add type hints to test functions in test_percent_patterns
Added type hints for function signatures and improved code clarity.
1 parent 34425fa commit a03f60a

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

pandas/tests/io/sql/test_percent_patterns.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,30 @@
11
# pandas/tests/io/sql/test_percent_patterns.py
22
import os
3-
43
import pytest
4+
from typing import TYPE_CHECKING
55

66
sa = pytest.importorskip("sqlalchemy")
77

8+
if TYPE_CHECKING:
9+
from sqlalchemy.engine import Engine
10+
811
PG = os.environ.get("PANDAS_TEST_POSTGRES_URI")
912
URL = PG or "sqlite+pysqlite:///:memory:"
1013

1114

12-
def _eng():
15+
def _eng() -> "Engine":
1316
return sa.create_engine(URL)
1417

1518

16-
def test_text_modulo():
19+
def test_text_modulo() -> None:
1720
import pandas as pd
1821

1922
with _eng().connect() as c:
2023
df = pd.read_sql(sa.text("SELECT 5 % 2 AS r"), c)
2124
assert df.iloc[0, 0] == 1
2225

2326

24-
def test_like_single_percent():
27+
def test_like_single_percent() -> None:
2528
import pandas as pd
2629

2730
with _eng().connect() as c:
@@ -32,7 +35,7 @@ def test_like_single_percent():
3235
assert len(df) == 1
3336

3437

35-
def test_sqlalchemy_expr_percent_operator():
38+
def test_sqlalchemy_expr_percent_operator() -> None:
3639
from sqlalchemy import (
3740
literal,
3841
select,

0 commit comments

Comments
 (0)