[ty] Add evaluation tasks for a few cases

I went through https://github.com/astral-sh/ty/issues/1274 and tried to
extract what I could into eval tasks. Some of the suggestions from that
issue have already been done, but most haven't.

This captures the status quo.
This commit is contained in:
Andrew Gallant 2025-12-11 14:16:45 -05:00
parent d6a5bbd91c
commit e59432fb40
No known key found for this signature in database
GPG Key ID: 5518C8B38E0693E0
17 changed files with 103 additions and 0 deletions

View File

@ -3,6 +3,7 @@ auto-import-includes-modules,main.py,0,1
auto-import-includes-modules,main.py,1,7
auto-import-includes-modules,main.py,2,1
auto-import-skips-current-module,main.py,0,1
exact-over-fuzzy,main.py,0,2
fstring-completions,main.py,0,1
higher-level-symbols-preferred,main.py,0,
higher-level-symbols-preferred,main.py,1,1
@ -15,6 +16,7 @@ import-deprioritizes-type_check_only,main.py,3,2
import-deprioritizes-type_check_only,main.py,4,3
import-keyword-completion,main.py,0,1
internal-typeshed-hidden,main.py,0,2
local-over-auto-import,main.py,0,2
none-completion,main.py,0,2
numpy-array,main.py,0,159
numpy-array,main.py,1,1
@ -25,7 +27,12 @@ raise-uses-base-exception,main.py,0,1
scope-existing-over-new-import,main.py,0,1
scope-prioritize-closer,main.py,0,2
scope-simple-long-identifier,main.py,0,1
tighter-over-looser-scope,main.py,0,3
tstring-completions,main.py,0,1
ty-extensions-lower-stdlib,main.py,0,9
type-var-typing-over-ast,main.py,0,3
type-var-typing-over-ast,main.py,1,251
typing-gets-priority,main.py,0,30
typing-gets-priority,main.py,1,3
typing-gets-priority,main.py,2,3
typing-gets-priority,main.py,3,95

1 name file index rank
3 auto-import-includes-modules main.py 1 7
4 auto-import-includes-modules main.py 2 1
5 auto-import-skips-current-module main.py 0 1
6 exact-over-fuzzy main.py 0 2
7 fstring-completions main.py 0 1
8 higher-level-symbols-preferred main.py 0
9 higher-level-symbols-preferred main.py 1 1
16 import-deprioritizes-type_check_only main.py 4 3
17 import-keyword-completion main.py 0 1
18 internal-typeshed-hidden main.py 0 2
19 local-over-auto-import main.py 0 2
20 none-completion main.py 0 2
21 numpy-array main.py 0 159
22 numpy-array main.py 1 1
27 scope-existing-over-new-import main.py 0 1
28 scope-prioritize-closer main.py 0 2
29 scope-simple-long-identifier main.py 0 1
30 tighter-over-looser-scope main.py 0 3
31 tstring-completions main.py 0 1
32 ty-extensions-lower-stdlib main.py 0 9
33 type-var-typing-over-ast main.py 0 3
34 type-var-typing-over-ast main.py 1 251
35 typing-gets-priority main.py 0 30
36 typing-gets-priority main.py 1 3
37 typing-gets-priority main.py 2 3
38 typing-gets-priority main.py 3 95

View File

@ -0,0 +1,2 @@
[settings]
auto-import = true

View File

@ -0,0 +1,3 @@
pattern = 1
pttn = 1
pttn<CURSOR: pttn>

View File

@ -0,0 +1,5 @@
[project]
name = "test"
version = "0.1.0"
requires-python = ">=3.13"
dependencies = []

View File

@ -0,0 +1,8 @@
version = 1
revision = 3
requires-python = ">=3.13"
[[package]]
name = "test"
version = "0.1.0"
source = { virtual = "." }

View File

@ -0,0 +1,2 @@
[settings]
auto-import = true

View File

@ -0,0 +1,11 @@
def foo(x):
# We specifically want the local `x` to be
# suggested first here, and NOT an `x` or an
# `X` from some other module (via auto-import).
# We'd also like this to come before `except`,
# which is a keyword that contains `x`, but is
# not an exact match (where as `x` is). `except`
# also isn't legal in this context, although
# that sort of context sensitivity is a bit
# trickier.
return x<CURSOR: x>

View File

@ -0,0 +1,5 @@
[project]
name = "test"
version = "0.1.0"
requires-python = ">=3.13"
dependencies = []

View File

@ -0,0 +1,8 @@
version = 1
revision = 3
requires-python = ">=3.13"
[[package]]
name = "test"
version = "0.1.0"
source = { virtual = "." }

View File

@ -0,0 +1,2 @@
[settings]
auto-import = true

View File

@ -0,0 +1,10 @@
scope1 = 1
def x():
scope2 = 1
def xx():
scope3 = 1
def xxx():
# We specifically want `scope3` to be
# suggested first here, since that's in
# the "tighter" scope.
scope<CURSOR: scope3>

View File

@ -0,0 +1,5 @@
[project]
name = "test"
version = "0.1.0"
requires-python = ">=3.13"
dependencies = []

View File

@ -0,0 +1,8 @@
version = 1
revision = 3
requires-python = ">=3.13"
[[package]]
name = "test"
version = "0.1.0"
source = { virtual = "." }

View File

@ -0,0 +1,2 @@
[settings]
auto-import = true

View File

@ -0,0 +1,12 @@
# We should prefer `typing` over `asyncio` here.
class Foo(Protoco<CURSOR: typing.Protocol>): ...
# We should prefer `typing` over `ty_extensions`
# or `typing_extensions`.
reveal_<CURSOR: typing.reveal_type>
# We should prefer `typing` over `ast`.
TypeVa<CURSOR: typing.TypeVar>
# We should prefer `typing` over `ctypes`.
cast<CURSOR: typing.cast>

View File

@ -0,0 +1,5 @@
[project]
name = "test"
version = "0.1.0"
requires-python = ">=3.13"
dependencies = []

View File

@ -0,0 +1,8 @@
version = 1
revision = 3
requires-python = ">=3.13"
[[package]]
name = "test"
version = "0.1.0"
source = { virtual = "." }