summaryrefslogtreecommitdiff
path: root/test/ext/mypy/plain_files/sql_operations.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2022-02-27 23:05:46 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2022-03-01 21:05:14 -0500
commitafb9634fb28b00c7b0979660e3e0bfed6caafde5 (patch)
tree11afb462226f64d922f9d3c425a7d2c09c3d69d7 /test/ext/mypy/plain_files/sql_operations.py
parent7f1a3f22abffc1529100e14fcfd07a46a49fd44f (diff)
downloadsqlalchemy-afb9634fb28b00c7b0979660e3e0bfed6caafde5.tar.gz
pep484 + abc bases for assocaitionproxy
went to this one next as it was going to be hard, and also exercises the ORM expression hierarchy a bit. made some adjustments to SQLCoreOperations etc. Change-Id: Ie5dde9218dc1318252826b766d3e70b17dd24ea7 References: #6810 References: #7774
Diffstat (limited to 'test/ext/mypy/plain_files/sql_operations.py')
-rw-r--r--test/ext/mypy/plain_files/sql_operations.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/ext/mypy/plain_files/sql_operations.py b/test/ext/mypy/plain_files/sql_operations.py
new file mode 100644
index 000000000..2cee1ddca
--- /dev/null
+++ b/test/ext/mypy/plain_files/sql_operations.py
@@ -0,0 +1,20 @@
+import typing
+
+from sqlalchemy import column
+from sqlalchemy import Integer
+
+# builtin.pyi stubs define object.__eq__() as returning bool, which
+# can't be overridden (it's final). So for us to type `__eq__()` and
+# `__ne__()`, we have to use type: ignore[override]. Test if does this mean
+# the typing tools don't know the type, or if they just ignore the error.
+# (it's fortunately the former)
+expr1 = column("x", Integer) == 10
+
+
+if typing.TYPE_CHECKING:
+
+ # as far as if this is ColumnElement, BinaryElement, SQLCoreOperations,
+ # that might change. main thing is it's SomeSQLColThing[bool] and
+ # not 'bool' or 'Any'.
+ # EXPECTED_TYPE: sqlalchemy..*ColumnElement\[builtins.bool\]
+ reveal_type(expr1)