summaryrefslogtreecommitdiff
path: root/test/ext/mypy/plain_files/sql_operations.py
diff options
context:
space:
mode:
authorFederico Caselli <cfederico87@gmail.com>2023-04-18 19:38:18 +0000
committerGerrit Code Review <gerrit@bbpush.zzzcomputing.com>2023-04-18 19:38:18 +0000
commit280322af927848f51aeb8cfe2f43de91960052ba (patch)
treedfa718b1b68c62c4a65c24f043089c95a91ec7e3 /test/ext/mypy/plain_files/sql_operations.py
parent756501b65a9c88790c1947d7c39956bfc374b8e8 (diff)
parentceec98e1d4d24389b10b3a26a693e94ddb70d65e (diff)
downloadsqlalchemy-280322af927848f51aeb8cfe2f43de91960052ba.tar.gz
Merge "Define type hints for remaining column operators" into main
Diffstat (limited to 'test/ext/mypy/plain_files/sql_operations.py')
-rw-r--r--test/ext/mypy/plain_files/sql_operations.py65
1 files changed, 48 insertions, 17 deletions
diff --git a/test/ext/mypy/plain_files/sql_operations.py b/test/ext/mypy/plain_files/sql_operations.py
index d658f3d50..95993f628 100644
--- a/test/ext/mypy/plain_files/sql_operations.py
+++ b/test/ext/mypy/plain_files/sql_operations.py
@@ -67,23 +67,54 @@ stmt = select(column("q")).where(lambda: column("g") > 5).where(c2 == 5)
expr9 = c1.bool_op("@@")(func.to_tsquery("some & query"))
-# add tests for #9148
-and_(c1.is_(q))
-and_(c1.is_not(q))
-and_(c1.isnot(q))
-and_(c1.not_in(["x"]))
-and_(c1.notin_(["x"]))
-and_(c1.not_like("x"))
-and_(c1.notlike("x"))
-and_(c1.not_ilike("x"))
-and_(c1.notilike("x"))
-
-# issue #9451
-s1 = c1.cast(Integer)
-s2 = c1.cast(Float)
-s3 = c1.op("foobar")("operand").cast(DateTime)
-s4 = cast(c1, Float)
-s5 = cast(c1.op("foobar")("operand"), DateTime)
+
+def test_issue_9418() -> None:
+ and_(c1.is_(q))
+ and_(c1.is_not(q))
+ and_(c1.isnot(q))
+ and_(c1.not_in(["x"]))
+ and_(c1.notin_(["x"]))
+ and_(c1.not_like("x"))
+ and_(c1.notlike("x"))
+ and_(c1.not_ilike("x"))
+ and_(c1.notilike("x"))
+
+
+def test_issue_9451() -> None:
+ # issue #9451
+ c1.cast(Integer)
+ c1.cast(Float)
+ c1.op("foobar")("operand").cast(DateTime)
+ cast(c1, Float)
+ cast(c1.op("foobar")("operand"), DateTime)
+
+
+def test_issue_9650_char() -> None:
+ and_(c1.contains("x"))
+ and_(c1.startswith("x"))
+ and_(c1.endswith("x"))
+ and_(c1.icontains("x"))
+ and_(c1.istartswith("x"))
+ and_(c1.iendswith("x"))
+
+
+def test_issue_9650_bitwise() -> None:
+ # EXPECTED_TYPE: BinaryExpression[Any]
+ reveal_type(c2.bitwise_and(5))
+ # EXPECTED_TYPE: BinaryExpression[Any]
+ reveal_type(c2.bitwise_or(5))
+ # EXPECTED_TYPE: BinaryExpression[Any]
+ reveal_type(c2.bitwise_xor(5))
+ # EXPECTED_TYPE: UnaryExpression[int]
+ reveal_type(c2.bitwise_not())
+ # EXPECTED_TYPE: BinaryExpression[Any]
+ reveal_type(c2.bitwise_lshift(5))
+ # EXPECTED_TYPE: BinaryExpression[Any]
+ reveal_type(c2.bitwise_rshift(5))
+ # EXPECTED_TYPE: ColumnElement[Any]
+ reveal_type(c2 << 5)
+ # EXPECTED_TYPE: ColumnElement[Any]
+ reveal_type(c2 >> 5)
if typing.TYPE_CHECKING: