[ty] Add evaluation test for auto-import including symbols in current module

This shouldn't happen. And indeed, currently, this results in a
sub-optimal ranking.
This commit is contained in:
Andrew Gallant 2025-10-27 14:30:24 -04:00 committed by Andrew Gallant
parent 9ce3fa3fe3
commit 2d4e0edee4
6 changed files with 36 additions and 0 deletions

View File

@ -1,4 +1,5 @@
name,file,index,rank
auto-import-skips-current-module,main.py,0,4
fstring-completions,main.py,0,1
higher-level-symbols-preferred,main.py,0,
higher-level-symbols-preferred,main.py,1,1

1 name file index rank
2 auto-import-skips-current-module main.py 0 4
3 fstring-completions main.py 0 1
4 higher-level-symbols-preferred main.py 0
5 higher-level-symbols-preferred main.py 1 1

View File

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

View File

@ -0,0 +1,19 @@
Kadabra = 1
# This is meant to reflect that auto-import
# does *not* include completions for `Kadabra`.
# That is, before a bug was fixed, completions
# would offer two variants for `Kadabra`: one
# for the current module (correct) and another
# from auto-import that would insert
# `from main import Kadabra` into this module
# (incorrect).
#
# Since the incorrect one wasn't ranked above
# the correct one, this task unfortunately
# doesn't change the evaluation results. But
# I've added it anyway in case it does in the
# future (or if we change our evaluation metric
# to something that incorporates suggestions
# after the correct one).
Kada<CURSOR: Kadabra>

View File

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

View File

@ -0,0 +1 @@
AbraKadabra = 1

View File

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