4
4
5
5
import pytest
6
6
from pylsp import uris
7
-
7
+ from pylsp . workspace import apply_text_edits
8
8
9
9
DOC_URI = uris .from_fs_path (__file__ )
10
10
@@ -299,7 +299,7 @@ def test_apply_text_edits_insert(pylsp):
299
299
pylsp .workspace .put_document (DOC_URI , '012345678901234567890123456789' )
300
300
test_doc = pylsp .workspace .get_document (DOC_URI )
301
301
302
- assert test_doc . apply_text_edits ([{
302
+ assert apply_text_edits (test_doc , [{
303
303
"range" : {
304
304
"start" : {
305
305
"line" : 0 ,
@@ -312,7 +312,7 @@ def test_apply_text_edits_insert(pylsp):
312
312
},
313
313
"newText" : "Hello"
314
314
}]) == 'Hello012345678901234567890123456789'
315
- assert test_doc . apply_text_edits ([{
315
+ assert apply_text_edits (test_doc , [{
316
316
"range" : {
317
317
"start" : {
318
318
"line" : 0 ,
@@ -325,7 +325,7 @@ def test_apply_text_edits_insert(pylsp):
325
325
},
326
326
"newText" : "Hello"
327
327
}]) == '0Hello12345678901234567890123456789'
328
- assert test_doc . apply_text_edits ([{
328
+ assert apply_text_edits (test_doc , [{
329
329
"range" : {
330
330
"start" : {
331
331
"line" : 0 ,
@@ -350,7 +350,7 @@ def test_apply_text_edits_insert(pylsp):
350
350
},
351
351
"newText" : "World"
352
352
}]) == '0HelloWorld12345678901234567890123456789'
353
- assert test_doc . apply_text_edits ([{
353
+ assert apply_text_edits (test_doc , [{
354
354
"range" : {
355
355
"start" : {
356
356
"line" : 0 ,
@@ -416,7 +416,7 @@ def test_apply_text_edits_replace(pylsp):
416
416
pylsp .workspace .put_document (DOC_URI , '012345678901234567890123456789' )
417
417
test_doc = pylsp .workspace .get_document (DOC_URI )
418
418
419
- assert test_doc . apply_text_edits ([{
419
+ assert apply_text_edits (test_doc , [{
420
420
"range" : {
421
421
"start" : {
422
422
"line" : 0 ,
@@ -429,7 +429,7 @@ def test_apply_text_edits_replace(pylsp):
429
429
},
430
430
"newText" : "Hello"
431
431
}]) == '012Hello678901234567890123456789'
432
- assert test_doc . apply_text_edits ([{
432
+ assert apply_text_edits (test_doc , [{
433
433
"range" : {
434
434
"start" : {
435
435
"line" : 0 ,
@@ -454,7 +454,7 @@ def test_apply_text_edits_replace(pylsp):
454
454
},
455
455
"newText" : "World"
456
456
}]) == '012HelloWorld901234567890123456789'
457
- assert test_doc . apply_text_edits ([{
457
+ assert apply_text_edits (test_doc , [{
458
458
"range" : {
459
459
"start" : {
460
460
"line" : 0 ,
@@ -479,7 +479,7 @@ def test_apply_text_edits_replace(pylsp):
479
479
},
480
480
"newText" : "World"
481
481
}]) == '012HelloWorld678901234567890123456789'
482
- assert test_doc . apply_text_edits ([{
482
+ assert apply_text_edits (test_doc , [{
483
483
"range" : {
484
484
"start" : {
485
485
"line" : 0 ,
@@ -504,7 +504,7 @@ def test_apply_text_edits_replace(pylsp):
504
504
},
505
505
"newText" : "Hello"
506
506
}]) == '012HelloWorld678901234567890123456789'
507
- assert test_doc . apply_text_edits ([{
507
+ assert apply_text_edits (test_doc , [{
508
508
"range" : {
509
509
"start" : {
510
510
"line" : 0 ,
@@ -537,7 +537,7 @@ def test_apply_text_edits_overlap(pylsp):
537
537
538
538
did_throw = False
539
539
try :
540
- test_doc . apply_text_edits ([{
540
+ apply_text_edits (test_doc , [{
541
541
"range" : {
542
542
"start" : {
543
543
"line" : 0 ,
@@ -568,7 +568,7 @@ def test_apply_text_edits_overlap(pylsp):
568
568
assert did_throw
569
569
570
570
try :
571
- test_doc . apply_text_edits ([{
571
+ apply_text_edits (test_doc , [{
572
572
"range" : {
573
573
"start" : {
574
574
"line" : 0 ,
@@ -602,7 +602,7 @@ def test_apply_text_edits_multiline(pylsp):
602
602
pylsp .workspace .put_document (DOC_URI , '0\n 1\n 2\n 3\n 4' )
603
603
test_doc = pylsp .workspace .get_document (DOC_URI )
604
604
605
- assert test_doc . apply_text_edits ([{
605
+ assert apply_text_edits (test_doc , [{
606
606
"range" : {
607
607
"start" : {
608
608
"line" : 2 ,
0 commit comments