diff options
| author | Federico Caselli <cfederico87@gmail.com> | 2023-02-28 22:44:27 +0100 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2023-03-03 10:40:17 -0500 |
| commit | c39dc697c1598c4a6a934dc0b5a60a0eaae6555d (patch) | |
| tree | 919992761ed4cc8c926da23617d3671b536022f5 /test/ext/mypy | |
| parent | da70478eb2eafe9c76b836217371e029c3c820e3 (diff) | |
| download | sqlalchemy-c39dc697c1598c4a6a934dc0b5a60a0eaae6555d.tar.gz | |
Add missing overload to Numeric
Added missing init overload to :class:`_sql.Numeric` to allow
type checkers to properly resolve the type var given the
``asdecimal`` parameter.
this fortunately fixes a glitch in the generate_sql_functions script
also
Fixes: #9391
Change-Id: I9cecc40c52711489e9dbe663f110c3b81c7285e4
Diffstat (limited to 'test/ext/mypy')
| -rw-r--r-- | test/ext/mypy/plain_files/functions.py | 4 | ||||
| -rw-r--r-- | test/ext/mypy/plain_files/sqltypes.py | 12 |
2 files changed, 14 insertions, 2 deletions
diff --git a/test/ext/mypy/plain_files/functions.py b/test/ext/mypy/plain_files/functions.py index ecd404010..09c2acf05 100644 --- a/test/ext/mypy/plain_files/functions.py +++ b/test/ext/mypy/plain_files/functions.py @@ -29,7 +29,7 @@ reveal_type(stmt3) stmt4 = select(func.cume_dist()) -# EXPECTED_RE_TYPE: .*Select\[Any\] +# EXPECTED_RE_TYPE: .*Select\[Tuple\[.*Decimal\]\] reveal_type(stmt4) @@ -89,7 +89,7 @@ reveal_type(stmt13) stmt14 = select(func.percent_rank()) -# EXPECTED_RE_TYPE: .*Select\[Any\] +# EXPECTED_RE_TYPE: .*Select\[Tuple\[.*Decimal\]\] reveal_type(stmt14) diff --git a/test/ext/mypy/plain_files/sqltypes.py b/test/ext/mypy/plain_files/sqltypes.py new file mode 100644 index 000000000..230cb957d --- /dev/null +++ b/test/ext/mypy/plain_files/sqltypes.py @@ -0,0 +1,12 @@ +from sqlalchemy import Float +from sqlalchemy import Numeric + +# EXPECTED_TYPE: Float[float] +reveal_type(Float()) +# EXPECTED_TYPE: Float[Decimal] +reveal_type(Float(asdecimal=True)) + +# EXPECTED_TYPE: Numeric[Decimal] +reveal_type(Numeric()) +# EXPECTED_TYPE: Numeric[float] +reveal_type(Numeric(asdecimal=False)) |
