@@ -15,8 +15,8 @@ local T = MiniTest.new_set({
1515 },
1616})
1717
18- local EDIT_ROOT_FILE_COMMAND = " edit tests/fixtures/root .py"
19- local EDIT_NESTED_FILE_COMMAND = " edit tests/fixtures/layer_one/layer_two/services .py"
18+ local EDIT_ROOT_FILE_COMMAND = " edit tests/fixtures/app .py"
19+ local EDIT_NESTED_FILE_COMMAND = " edit tests/fixtures/user/models .py"
2020
2121--- @param command string Full command to execute
2222--- @param register string Register to check
@@ -40,16 +40,15 @@ T[":CopyPythonPath"]["dotted"] = MiniTest.new_set()
4040T [" :CopyPythonPath" ][" dotted" ][" root level Python file" ] = function ()
4141 child .api .nvim_command (EDIT_ROOT_FILE_COMMAND )
4242 local test_cases = {
43- -- Importable symbols
44- { { 5 , 5 }, " root.func" },
45- { { 9 , 16 }, " root.async_func" },
46- { { 13 , 7 }, " root.OuterClass" },
47- { { 18 , 13 }, " root.OuterClass.InnerClass.inner_class_method" },
48- { { 22 , 10 }, " root.MODULE_LEVEL_CONSTANT" },
49- { { 15 , 16 }, " numpy" },
50- { { 6 , 5 }, " layer_one.layer_two.services.some_service" },
51- -- Non-importable symbol
52- { { 15 , 26 }, " root" },
43+ { { 5 , 5 }, " app.func_1" },
44+ { { 9 , 11 }, " app.func_2" },
45+ { { 13 , 9 }, " app.MyClass" },
46+ { { 14 , 11 }, " app.MyClass.Meta" },
47+ { { 17 , 9 }, " app.MyClass.method_1" },
48+ { { 18 , 9 }, " user.models.User" },
49+ { { 19 , 16 }, " numpy" },
50+ { { 22 , 1 }, " app.MODULE_VAR" },
51+ { { 6 , 5 }, " app" }, -- non-importable symbol
5352 }
5453 run_test_cases (" CopyPythonPath dotted a" , " a" , test_cases )
5554end
@@ -58,10 +57,10 @@ T[":CopyPythonPath"]["dotted"]["nested Python file"] = function()
5857 child .api .nvim_command (EDIT_NESTED_FILE_COMMAND )
5958 local test_cases = {
6059 -- Importable symbols
61- { { 4 , 5 }, " layer_one.layer_two.services.some_service " },
62- { { 5 , 12 }, " numpy " },
60+ { { 5 , 7 }, " user.models.User " },
61+ { { 4 , 4 }, " attrs.define " },
6362 -- Non-importable symbol
64- { { 5 , 21 }, " layer_one.layer_two.services " },
63+ { { 6 , 9 }, " user.models " },
6564 }
6665 run_test_cases (" CopyPythonPath dotted a" , " a" , test_cases )
6766end
@@ -71,16 +70,15 @@ T[":CopyPythonPath"]["import"] = MiniTest.new_set()
7170T [" :CopyPythonPath" ][" import" ][" root level Python file" ] = function ()
7271 child .api .nvim_command (EDIT_ROOT_FILE_COMMAND )
7372 local test_cases = {
74- -- Importable symbols
75- { { 5 , 5 }, " from root import func" },
76- { { 9 , 16 }, " from root import async_func" },
77- { { 13 , 7 }, " from root import OuterClass" },
78- { { 18 , 13 }, " from root import OuterClass" },
79- { { 22 , 10 }, " from root import MODULE_LEVEL_CONSTANT" },
80- { { 15 , 16 }, " import numpy" },
81- { { 6 , 5 }, " from layer_one.layer_two.services import some_service" },
82- -- Non-importable symbol
83- { { 15 , 26 }, " from root import " },
73+ { { 5 , 5 }, " from app import func_1" },
74+ { { 9 , 11 }, " from app import func_2" },
75+ { { 13 , 9 }, " from app import MyClass" },
76+ { { 14 , 11 }, " from app import MyClass" }, -- MyClass.Meta
77+ { { 17 , 9 }, " from app import MyClass" }, -- MyClass.method_1
78+ { { 18 , 9 }, " from user.models import User" },
79+ { { 19 , 16 }, " import numpy" },
80+ { { 22 , 1 }, " from app import MODULE_VAR" },
81+ { { 6 , 5 }, " from app import " }, -- non-importable symbol
8482 }
8583 run_test_cases (" CopyPythonPath import a" , " a" , test_cases )
8684end
@@ -89,10 +87,10 @@ T[":CopyPythonPath"]["import"]["nested Python file"] = function()
8987 child .api .nvim_command (EDIT_NESTED_FILE_COMMAND )
9088 local test_cases = {
9189 -- Importable symbols
92- { { 4 , 5 }, " from layer_one.layer_two.services import some_service " },
93- { { 5 , 12 }, " import numpy " },
90+ { { 5 , 7 }, " from user.models import User " },
91+ { { 4 , 4 }, " from attrs import define " },
9492 -- Non-importable symbol
95- { { 5 , 21 }, " from layer_one.layer_two.services import " },
93+ { { 6 , 9 }, " from user.models import " },
9694 }
9795 run_test_cases (" CopyPythonPath import a" , " a" , test_cases )
9896end
@@ -104,7 +102,7 @@ T[":CopyPythonPath"]["copies to clipboard if no register is provided"] = functio
104102 child .api .nvim_command (" CopyPythonPath dotted" )
105103
106104 local dotted_path = child .fn .getreg (" +" )
107- expect .equality (dotted_path , " root.func " )
105+ expect .equality (dotted_path , " app.func_1 " )
108106end
109107
110108return T
0 commit comments