repo_id
stringclasses
409 values
prefix
large_stringlengths
34
36.3k
target
large_stringlengths
1
498
assertion_type
stringclasses
31 values
difficulty
stringclasses
8 values
test_file
stringlengths
10
121
test_function
stringlengths
1
104
test_class
stringlengths
0
51
lineno
int32
2
11.3k
commit_idx
int32
tefra/xsdata
from collections.abc import Generator from xsdata.codegen.handlers import VacuumInnerClasses from xsdata.models.enums import DataType from xsdata.utils.testing import ( AttrFactory, AttrTypeFactory, ClassFactory, ExtensionFactory, FactoryTestCase, ) class VacuumInnerClassesTests(FactoryTestCase): ...
next(result))
self.assertEqual
func_call
tests/codegen/handlers/test_vacuum_inner_classes.py
test_find_attr_types_with_attr_choices
VacuumInnerClassesTests
125
null
tefra/xsdata
from unittest import mock from xsdata.codegen.container import ClassContainer from xsdata.codegen.utils import ClassUtils from xsdata.codegen.validator import ClassValidator from xsdata.models.config import GeneratorConfig from xsdata.models.enums import DataType, Tag from xsdata.utils.testing import ( AttrFactory...
[first, second])
assert_*
collection
tests/codegen/test_validator.py
test_process
ClassValidatorTests
40
null
tefra/xsdata
import string from unittest import TestCase from xsdata.utils.text import ( CharType, alnum, camel_case, capitalize, classify, kebab_case, mixed_case, mixed_pascal_case, mixed_snake_case, original_case, pascal_case, screaming_snake_case, snake_case, split_words, ...
alnum(" foo_1 "))
self.assertEqual
func_call
tests/utils/test_text.py
test_alnum
TextTests
145
null
tefra/xsdata
import pytest from tests.formats.dataclass.cases import ( attribute, attributes, element, elements, wildcard, ) from xsdata.formats.dataclass.typing import ( evaluate, evaluate_attribute, evaluate_attributes, evaluate_element, evaluate_elements, evaluate_wildcard, ) def tes...
str
assert
variable
tests/formats/dataclass/test_typing.py
test_evaluate_with_typevar
22
null
tefra/xsdata
from xsdata.codegen.container import ClassContainer from xsdata.codegen.handlers import UnnestInnerClasses from xsdata.models.config import GeneratorConfig from xsdata.utils.testing import ( AttrFactory, AttrTypeFactory, ClassFactory, FactoryTestCase, ) class UnnestInnerClassesTests(FactoryTestCase): ...
c.qname)
self.assertEqual
complex_expr
tests/codegen/handlers/test_unnest_inner_classes.py
test_update_inner_class
UnnestInnerClassesTests
91
null
tefra/xsdata
from dataclasses import replace from xsdata.codegen.container import ClassContainer from xsdata.codegen.handlers import DisambiguateChoices from xsdata.codegen.models import Restrictions, Status from xsdata.models.config import GeneratorConfig from xsdata.models.enums import DataType, Tag from xsdata.utils.testing imp...
last.type)
self.assertEqual
complex_expr
tests/codegen/handlers/test_disambiguate_choices.py
test_add_extension
DisambiguateChoicesTest
250
null
tefra/xsdata
from unittest import mock from xsdata.codegen.container import ClassContainer from xsdata.codegen.handlers import ProcessAttributeTypes from xsdata.codegen.models import Restrictions, Status from xsdata.codegen.utils import ClassUtils from xsdata.models.config import GeneratorConfig from xsdata.models.enums import Dat...
attr.help)
self.assertEqual
complex_expr
tests/codegen/handlers/test_process_attributes_types.py
test_copy_attribute_properties
ProcessAttributeTypesTests
294
null
tefra/xsdata
from dataclasses import field, make_dataclass from unittest import TestCase from tests.fixtures.artists import Artist from tests.fixtures.models import UnionType from xsdata.exceptions import ParserError from xsdata.formats.dataclass.context import XmlContext from xsdata.formats.dataclass.models.elements import XmlTyp...
node.level)
self.assertEqual
complex_expr
tests/formats/dataclass/parsers/nodes/test_union.py
test_child
UnionNodeTests
38
null
tefra/xsdata
from unittest import mock from xsdata.codegen.container import ClassContainer from xsdata.codegen.utils import ClassUtils from xsdata.codegen.validator import ClassValidator from xsdata.models.config import GeneratorConfig from xsdata.models.enums import DataType, Tag from xsdata.utils.testing import ( AttrFactory...
two.help)
self.assertEqual
complex_expr
tests/codegen/test_validator.py
test_merge_global_types
ClassValidatorTests
137
null
tefra/xsdata
import pickle import tempfile from pathlib import Path from unittest import mock from toposort import CircularDependencyError from xsdata import __version__ from xsdata.codegen.container import ClassContainer from xsdata.codegen.exceptions import CodegenError from xsdata.codegen.mappers import ( DefinitionsMapper...
len(result))
self.assertEqual
func_call
tests/codegen/test_transformer.py
test_analyze_classes
ResourceTransformerTests
467
null
tefra/xsdata
from datetime import date, datetime, time, timedelta, timezone from unittest import TestCase from xsdata.models.datatype import XmlDate, XmlDateTime, XmlDuration, XmlPeriod, XmlTime def filter_none(mapping: dict) -> dict: return {k: v for k, v in mapping.items() if v is not None} class XmlDateTests(TestCase): ...
value)
self.assertEqual
variable
tests/models/test_datatype.py
test_repr
XmlDateTests
63
null
tefra/xsdata
from unittest import mock from xsdata.codegen.exceptions import CodegenError from xsdata.codegen.models import Class from xsdata.codegen.resolver import DependenciesResolver from xsdata.models.enums import DataType from xsdata.utils.namespaces import build_qname from xsdata.utils.testing import ( AttrFactory, ...
result[0])
self.assertEqual
complex_expr
tests/codegen/test_resolver.py
test_sorted_imports
DependenciesResolverTest
55
null
tefra/xsdata
from collections.abc import Generator, Iterator from unittest import TestCase from xsdata.codegen.exceptions import CodegenError from xsdata.models.enums import FormType, Namespace from xsdata.models.mixins import ElementBase from xsdata.models.xsd import Alternative, ComplexType, Element, SimpleType class ElementBas...
list(children))
self.assertEqual
func_call
tests/models/test_mixins.py
test_children
ElementBaseTests
189
null
python-lsp/python-lsp-server
import os import tempfile from textwrap import dedent from unittest.mock import patch from pylsp import lsp, uris from pylsp.plugins import flake8_lint from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = """import pylsp t = "TEST" def using_const(): \ta = 8 + 9 \treturn t """ def temp_...
lsp.DiagnosticSeverity.Warning
assert
complex_expr
test/plugins/test_flake8_lint.py
test_flake8_unsaved
43
null
python-lsp/python-lsp-server
import pytest from pylsp import uris from pylsp.plugins.autopep8_format import pylsp_format_document, pylsp_format_range from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = """a = 123 def func(): pass """ GOOD_DOC = """A = ['hello', 'world']\n""" INDENTED_DOC = """def foo(): ...
"a = 123\n\n\n\n\ndef func():\n pass\n"
assert
string_literal
test/plugins/test_autopep8_format.py
test_range_format
62
null
python-lsp/python-lsp-server
import math import os import sys from pathlib import Path from typing import NamedTuple import pytest from pylsp import lsp, uris from pylsp._utils import JEDI_VERSION from pylsp.plugins.jedi_completion import ( pylsp_completion_item_resolve as pylsp_jedi_completion_item_resolve, ) from pylsp.plugins.jedi_complet...
None
assert
none_literal
test/plugins/test_completion.py
test_rope_import_completion
58
null
python-lsp/python-lsp-server
import os import sys import pytest from pylsp import uris from pylsp.lsp import SymbolKind from pylsp.plugins.symbols import pylsp_document_symbols from pylsp.workspace import Document PY2 = sys.version[0] == "2" LINUX = sys.platform.startswith("linux") CI = os.environ.get("CI") DOC_URI = uris.from_fs_path(__file__)...
SymbolKind.Class
assert
complex_expr
test/plugins/test_symbols.py
helper_check_symbols_all_scope
54
null
python-lsp/python-lsp-server
from pylsp import lsp, uris from pylsp.plugins import mccabe_lint from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = """def hello(): \tpass """ DOC_SYNTAX_ERR = """def hello() \tpass""" def test_mccabe(config, workspace) -> None: old_settings = config.settings try: confi...
{"line": 0, "character": 0}
assert
collection
test/plugins/test_mccabe_lint.py
test_mccabe
31
null
python-lsp/python-lsp-server
import pytest from pylsp import uris from test import unix_only, windows_only @unix_only @pytest.mark.parametrize( "uri,path", [ ("file:///foo/bar#frag", "/foo/bar"), ("file:/foo/bar#frag", "/foo/bar"), ("file:/foo/space%20%3Fbar#frag", "/foo/space ?bar"), ], ) def test_to_fs_path(...
path
assert
variable
test/test_uris.py
test_to_fs_path
20
null
python-lsp/python-lsp-server
from unittest.mock import patch import pytest from pylsp import IS_WIN from test.test_notebook_document import wait_for_condition from test.test_utils import send_initialize_request INITIALIZATION_OPTIONS = { "pylsp": { "plugins": { "flake8": {"enabled": True}, "pycodestyle": {"en...
False
assert
bool_literal
test/test_configuration.py
test_set_flake8_using_workspace_did_change_configuration
38
null
python-lsp/python-lsp-server
import os import pytest from pylsp import uris from pylsp.plugins.references import pylsp_references from pylsp.workspace import Document DOC1_NAME = "test1.py" DOC2_NAME = "test2.py" DOC1 = """class Test1(): pass """ DOC2 = """from test1 import Test1 try: Test1() except UnicodeError: pass """ def tm...
1
assert
numeric_literal
test/plugins/test_references.py
test_references
51
null
python-lsp/python-lsp-server
import math import os import sys from pathlib import Path from typing import NamedTuple import pytest from pylsp import lsp, uris from pylsp._utils import JEDI_VERSION from pylsp.plugins.jedi_completion import ( pylsp_completion_item_resolve as pylsp_jedi_completion_item_resolve, ) from pylsp.plugins.jedi_complet...
out
assert
variable
test/plugins/test_completion.py
test_snippet_parsing
423
null
python-lsp/python-lsp-server
import pytest from pylsp import uris from pylsp.plugins.yapf_format import pylsp_format_document, pylsp_format_range from pylsp.text_edit import apply_text_edits from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = """A = [ 'h', 'w', 'a' ] B = ['h', 'w'] """ GOOD_DOC =...
"A = [\n 'h', 'w',\n 'a'\n]\n\nB = ['h', 'w']\n"
assert
string_literal
test/plugins/test_yapf_format.py
test_config_file
65
null
python-lsp/python-lsp-server
from pylsp.workspace import Document from test.fixtures import DOC, DOC_URI def test_offset_at_position(doc) -> None: assert doc.offset_at_position({"line": 0, "character": 8}) == 8 assert doc.offset_at_position({"line": 1, "character": 5}) ==
16
assert
numeric_literal
test/test_document.py
test_offset_at_position
26
null
python-lsp/python-lsp-server
from pylsp.workspace import Document from test.fixtures import DOC, DOC_URI def test_word_at_position(doc) -> None: """Return the position under the cursor (or last in line if past the end)""" # import sys assert doc.word_at_position({"line": 0, "character": 8}) ==
"sys"
assert
string_literal
test/test_document.py
test_word_at_position
35
null
python-lsp/python-lsp-server
import os import sys import pytest from pylsp import uris from pylsp.lsp import SymbolKind from pylsp.plugins.symbols import pylsp_document_symbols from pylsp.workspace import Document PY2 = sys.version[0] == "2" LINUX = sys.platform.startswith("linux") CI = os.environ.get("CI") DOC_URI = uris.from_fs_path(__file__)...
8
assert
numeric_literal
test/plugins/test_symbols.py
helper_check_symbols_all_scope
47
null
python-lsp/python-lsp-server
import os import pathlib import pytest from pylsp import uris DOC_URI = uris.from_fs_path(__file__) NOTEBOOK_URI = uris.from_fs_path("notebook_uri") def path_as_uri(path): return pathlib.Path(os.path.abspath(path)).as_uri() def test_multiple_workspaces_from_initialize(pylsp_w_workspace_folders) -> None: py...
pylsp.root_uri
assert
complex_expr
test/test_workspace.py
test_multiple_workspaces_from_initialize
95
null
python-lsp/python-lsp-server
import multiprocessing import os import sys import time from threading import Thread from typing import Any from unittest import mock from docstring_to_markdown import UnknownFormatError from flaky import flaky from pylsp import _utils from pylsp.lsp import NotebookCellKind from pylsp.python_lsp import PythonLSPServe...
"string"
assert
string_literal
test/test_utils.py
test_list_to_string
186
null
python-lsp/python-lsp-server
import pytest from pylsp import uris from pylsp.plugins.autopep8_format import pylsp_format_document, pylsp_format_range from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = """a = 123 def func(): pass """ GOOD_DOC = """A = ['hello', 'world']\n""" INDENTED_DOC = """def foo(): ...
CORRECT_INDENTED_DOC
assert
variable
test/plugins/test_autopep8_format.py
test_hanging_indentation
75
null
python-lsp/python-lsp-server
import time from unittest.mock import call, patch import pytest from pylsp import IS_WIN from pylsp.lsp import NotebookCellKind from pylsp.workspace import Notebook from test.test_utils import ( CALL_TIMEOUT_IN_SECONDS, send_initialize_request, send_notebook_did_open, ) def wait_for_condition(condition, ...
True
assert
bool_literal
test/test_notebook_document.py
test_workspace_did_change_configuration
74
null
python-lsp/python-lsp-server
from unittest.mock import patch import pytest from pylsp import IS_WIN from test.test_notebook_document import wait_for_condition from test.test_utils import send_initialize_request INITIALIZATION_OPTIONS = { "pylsp": { "plugins": { "flake8": {"enabled": True}, "pycodestyle": {"en...
value.get("enabled")
assert
func_call
test/test_configuration.py
test_set_flake8_using_workspace_did_change_configuration
51
null
python-lsp/python-lsp-server
import pytest from pylsp import uris from pylsp.plugins import signature from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = """import sys def main(param1, param2): \"\"\" Main docstring Args: param1 (str): Docs for param1 \"\"\" raise Exception() main( """ MUL...
0
assert
numeric_literal
test/plugins/test_signature.py
test_signature
70
null
python-lsp/python-lsp-server
import os import pytest from pylsp import lsp, uris from pylsp.plugins import pycodestyle_lint from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = """import sys def hello( ): \tpass print("hello" ,"world" ) import json """ def test_pycodestyle(workspace) -> None: doc = Document...
"E201"
assert
string_literal
test/plugins/test_pycodestyle_lint.py
test_pycodestyle
53
null
python-lsp/python-lsp-server
import math import os import sys from pathlib import Path from typing import NamedTuple import pytest from pylsp import lsp, uris from pylsp._utils import JEDI_VERSION from pylsp.plugins.jedi_completion import ( pylsp_completion_item_resolve as pylsp_jedi_completion_item_resolve, ) from pylsp.plugins.jedi_complet...
expected
assert
variable
test/plugins/test_completion.py
test_jedi_completion_with_fuzzy_enabled
185
null
python-lsp/python-lsp-server
from typing import Any from unittest.mock import Mock, patch import jedi import parso import pytest from pylsp import IS_WIN, lsp, uris from pylsp.config.config import Config from pylsp.plugins.rope_autoimport import ( _get_score, _should_insert, cache, get_name_or_module, get_names, ) from pylsp....
result2
assert
variable
test/plugins/test_autoimport.py
test_sort_sources
201
null
python-lsp/python-lsp-server
import pytest from pylsp import uris from pylsp.plugins.autopep8_format import pylsp_format_document, pylsp_format_range from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = """a = 123 def func(): pass """ GOOD_DOC = """A = ['hello', 'world']\n""" INDENTED_DOC = """def foo(): ...
1
assert
numeric_literal
test/plugins/test_autopep8_format.py
test_format
46
null
python-lsp/python-lsp-server
import pytest from pylsp import uris from pylsp.plugins.yapf_format import pylsp_format_document, pylsp_format_range from pylsp.text_edit import apply_text_edits from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = """A = [ 'h', 'w', 'a' ] B = ['h', 'w'] """ GOOD_DOC =...
""
assert
string_literal
test/plugins/test_yapf_format.py
test_format_returns_text_edit_per_line
112
null
python-lsp/python-lsp-server
import os import sys import pytest from pylsp import uris from pylsp.lsp import SymbolKind from pylsp.plugins.symbols import pylsp_document_symbols from pylsp.workspace import Document PY2 = sys.version[0] == "2" LINUX = sys.platform.startswith("linux") CI = os.environ.get("CI") DOC_URI = uris.from_fs_path(__file__)...
5
assert
numeric_literal
test/plugins/test_symbols.py
test_symbols
69
null
python-lsp/python-lsp-server
import os import tempfile from textwrap import dedent from unittest.mock import patch from pylsp import lsp, uris from pylsp.plugins import flake8_lint from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = """import pylsp t = "TEST" def using_const(): \ta = 8 + 9 \treturn t """ def temp_...
flake8_settings
assert
variable
test/plugins/test_flake8_lint.py
test_flake8_multiline
185
null
python-lsp/python-lsp-server
import os from pylsp import uris from pylsp.plugins.hover import pylsp_hover from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = """ def main(a: float, b: float): \"\"\"hello world\"\"\" pass """ NUMPY_DOC = """ import numpy as np np.sin """ def test_numpy_hover(workspace) ->...
pylsp_hover(doc._config, doc, no_hov_position)["contents"]
assert
func_call
test/plugins/test_hover.py
test_numpy_hover
41
null
python-lsp/python-lsp-server
import math import os import sys from pathlib import Path from typing import NamedTuple import pytest from pylsp import lsp, uris from pylsp._utils import JEDI_VERSION from pylsp.plugins.jedi_completion import ( pylsp_completion_item_resolve as pylsp_jedi_completion_item_resolve, ) from pylsp.plugins.jedi_complet...
"FOOBAR"
assert
string_literal
test/plugins/test_completion.py
test_completion_with_class_objects
376
null
python-lsp/python-lsp-server
from pylsp import uris from pylsp.text_edit import OverLappingTextEditException, apply_text_edits DOC_URI = uris.from_fs_path(__file__) def test_apply_text_edits_replace(pylsp) -> None: pylsp.workspace.put_document(DOC_URI, "012345678901234567890123456789") test_doc = pylsp.workspace.get_document(DOC_URI) ...
"012WorldHello678901234567890123456789"
assert
string_literal
test/test_text_edit.py
test_apply_text_edits_replace
196
null
python-lsp/python-lsp-server
import pytest from pylsp import uris from pylsp.plugins.yapf_format import pylsp_format_document, pylsp_format_range from pylsp.text_edit import apply_text_edits from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = """A = [ 'h', 'w', 'a' ] B = ['h', 'w'] """ GOOD_DOC =...
"A = ['h', 'w', 'a']\n\nB = ['h', 'w']\n"
assert
string_literal
test/plugins/test_yapf_format.py
test_format
34
null
python-lsp/python-lsp-server
from pylsp import uris from pylsp.text_edit import OverLappingTextEditException, apply_text_edits DOC_URI = uris.from_fs_path(__file__) def test_apply_text_edits_insert(pylsp) -> None: pylsp.workspace.put_document(DOC_URI, "012345678901234567890123456789") test_doc = pylsp.workspace.get_document(DOC_URI) ...
"0HelloWorld12345678901234567890123456789"
assert
string_literal
test/test_text_edit.py
test_apply_text_edits_insert
44
null
python-lsp/python-lsp-server
from pylsp import lsp, uris from pylsp.plugins.highlight import pylsp_document_highlight from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = """a = "hello" a.startswith("b") """ def test_highlight(workspace) -> None: # Over 'a' in a.startswith cursor_pos = {"line": 1, "character":...
[ { "range": { "start": {"line": 0, "character": 0}, "end": {"line": 0, "character": 1}, }, # The first usage is Write "kind": lsp.DocumentHighlightKind.Write, }, { "range": { "start": {"line": 1, "character": 0}, "end": {"line": 1, "character": 1}, }, # The second usage is Read "kind": lsp.DocumentHighlightKind.Read, ...
assert
collection
test/plugins/test_highlight.py
test_highlight
19
null
python-lsp/python-lsp-server
import os import pytest from pylsp import lsp, uris from pylsp.plugins import pycodestyle_lint from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = """import sys def hello( ): \tpass print("hello" ,"world" ) import json """ def test_pycodestyle_config(workspace) -> None: """Test...
0 if working else 1
assert
complex_expr
test/plugins/test_pycodestyle_lint.py
test_pycodestyle_config
105
null
python-lsp/python-lsp-server
from typing import Any from unittest.mock import Mock, patch import jedi import parso import pytest from pylsp import IS_WIN, lsp, uris from pylsp.config.config import Config from pylsp.plugins.rope_autoimport import ( _get_score, _should_insert, cache, get_name_or_module, get_names, ) from pylsp....
"os"
assert
string_literal
test/plugins/test_autoimport.py
test_autoimport_code_actions_get_correct_module_name
255
null
python-lsp/python-lsp-server
from pylsp import lsp, uris from pylsp.plugins.highlight import pylsp_document_highlight from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = """a = "hello" a.startswith("b") """ def test_sys_highlight(workspace) -> None: cursor_pos = {"line": 0, "character": 8} doc = Document(DOC...
[ { "range": { "start": {"line": 0, "character": 7}, "end": {"line": 0, "character": 10}, }, "kind": lsp.DocumentHighlightKind.Write, }, { "range": { "start": {"line": 1, "character": 6}, "end": {"line": 1, "character": 9}, }, "kind": lsp.DocumentHighlightKind.Read, }, ]
assert
collection
test/plugins/test_highlight.py
test_sys_highlight
48
null
python-lsp/python-lsp-server
import contextlib import os import tempfile from pathlib import Path from pylsp import lsp, uris from pylsp.plugins import pylint_lint from pylsp.workspace import Document, Workspace DOC_URI = uris.from_fs_path(__file__) DOC = """import sys def hello(): \tpass import json """ DOC_SYNTAX_ERR = """def hello() pa...
lsp.DiagnosticSeverity.Warning
assert
complex_expr
test/plugins/test_pylint_lint.py
test_pylint
52
null
python-lsp/python-lsp-server
from pylsp.workspace import Document from test.fixtures import DOC, DOC_URI def test_document_end_of_file_edit(workspace) -> None: old = ["print 'a'\n", "print 'b'\n"] doc = Document("file:///uri", workspace, "".join(old)) doc.apply_change( { "text": "o", "range": { ...
[ "print 'a'\n", "print 'b'\n", "o", ]
assert
collection
test/test_document.py
test_document_end_of_file_edit
101
null
python-lsp/python-lsp-server
import os import pytest from pylsp import uris from pylsp.plugins.jedi_rename import pylsp_rename from pylsp.workspace import Document DOC_NAME = "test1.py" DOC = """class Test1(): pass class Test2(Test1): pass """ DOC_NAME_EXTRA = "test2.py" DOC_EXTRA = """from test1 import Test1 x = Test1() """ DOC_NAME...
1
assert
numeric_literal
test/plugins/test_jedi_rename.py
test_jedi_rename
43
null
python-lsp/python-lsp-server
from pylsp import lsp, uris from pylsp.plugins import mccabe_lint from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = """def hello(): \tpass """ DOC_SYNTAX_ERR = """def hello() \tpass""" def test_mccabe(config, workspace) -> None: old_settings = config.settings try: confi...
lsp.DiagnosticSeverity.Warning
assert
complex_expr
test/plugins/test_mccabe_lint.py
test_mccabe
30
null
python-lsp/python-lsp-server
from pylsp import uris from pylsp.text_edit import OverLappingTextEditException, apply_text_edits DOC_URI = uris.from_fs_path(__file__) def test_apply_text_edits_insert(pylsp) -> None: pylsp.workspace.put_document(DOC_URI, "012345678901234567890123456789") test_doc = pylsp.workspace.get_document(DOC_URI) ...
"Hello012345678901234567890123456789"
assert
string_literal
test/test_text_edit.py
test_apply_text_edits_insert
14
null
python-lsp/python-lsp-server
import pytest from pylsp import uris from pylsp.plugins.yapf_format import pylsp_format_document, pylsp_format_range from pylsp.text_edit import apply_text_edits from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = """A = [ 'h', 'w', 'a' ] B = ['h', 'w'] """ GOOD_DOC =...
"A = ['h', 'w', 'a']\n\nB = ['h',\n\n\n'w']\n"
assert
string_literal
test/plugins/test_yapf_format.py
test_range_format
47
null
python-lsp/python-lsp-server
import os import pytest from pylsp import lsp, uris from pylsp.plugins import pycodestyle_lint from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = """import sys def hello( ): \tpass print("hello" ,"world" ) import json """ def test_pycodestyle(workspace) -> None: doc = Document...
"E128"
assert
string_literal
test/plugins/test_pycodestyle_lint.py
test_pycodestyle
61
null
python-lsp/python-lsp-server
import os import sys import pytest from pylsp import uris from pylsp.lsp import SymbolKind from pylsp.plugins.symbols import pylsp_document_symbols from pylsp.workspace import Document PY2 = sys.version[0] == "2" LINUX = sys.platform.startswith("linux") CI = os.environ.get("CI") DOC_URI = uris.from_fs_path(__file__)...
SymbolKind.Function
assert
complex_expr
test/plugins/test_symbols.py
helper_check_symbols_all_scope
56
null
python-lsp/python-lsp-server
import sys from textwrap import dedent from pylsp import uris from pylsp.plugins.folding import pylsp_folding_range from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = dedent( """ def func(arg1, arg2, arg3, arg4, arg5, default=func( 2, 3, 4 )): retur...
expected
assert
variable
test/plugins/test_folding.py
test_folding
160
null
python-lsp/python-lsp-server
from pylsp.workspace import Document from test.fixtures import DOC, DOC_URI def test_document_multiline_edit(workspace) -> None: old = ["def hello(a, b):\n", " print a\n", " print b\n"] doc = Document("file:///uri", workspace, "".join(old)) doc.apply_change( { "text": "print a, b"...
["def hello(a, b):\n", " print a, b\n"]
assert
collection
test/test_document.py
test_document_multiline_edit
86
null
python-lsp/python-lsp-server
import sys from pylsp import lsp, uris from pylsp.plugins import pyflakes_lint from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = """import sys def hello(): \tpass import json """ DOC_SYNTAX_ERR = """def hello() pass """ DOC_UNDEFINED_NAME_ERR = "a = b" DOC_ENCODING = """# encod...
"expected ':'"
assert
string_literal
test/plugins/test_pyflakes_lint.py
test_syntax_error_pyflakes
48
null
python-lsp/python-lsp-server
import os import tempfile from textwrap import dedent from unittest.mock import patch from pylsp import lsp, uris from pylsp.plugins import flake8_lint from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = """import pylsp t = "TEST" def using_const(): \ta = 8 + 9 \treturn t """ def temp_...
call_args
assert
variable
test/plugins/test_flake8_lint.py
test_flake8_config_param
134
null
python-lsp/python-lsp-server
import pytest from pylsp import uris from pylsp.plugins.yapf_format import pylsp_format_document, pylsp_format_range from pylsp.text_edit import apply_text_edits from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = """A = [ 'h', 'w', 'a' ] B = ['h', 'w'] """ GOOD_DOC =...
' log("x")\n'
assert
string_literal
test/plugins/test_yapf_format.py
test_format_returns_text_edit_per_line
114
null
python-lsp/python-lsp-server
import os import sys import time import pytest from flaky import flaky from pylsp_jsonrpc.exceptions import JsonRpcMethodNotFound from test.test_utils import ClientServerPair, send_initialize_request RUNNING_IN_CI = bool(os.environ.get("CI")) CALL_TIMEOUT_IN_SECONDS = 10 def client_exited_server() -> None: """...
response
assert
variable
test/test_language_server.py
test_initialize
39
null
python-lsp/python-lsp-server
from pylsp import lsp, uris from pylsp.plugins import mccabe_lint from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = """def hello(): \tpass """ DOC_SYNTAX_ERR = """def hello() \tpass""" def test_mccabe_syntax_error(config, workspace) -> None: doc = Document(DOC_URI, workspace, DOC_S...
None
assert
none_literal
test/plugins/test_mccabe_lint.py
test_mccabe_syntax_error
39
null
python-lsp/python-lsp-server
import sys from pylsp import lsp, uris from pylsp.plugins import pyflakes_lint from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = """import sys def hello(): \tpass import json """ DOC_SYNTAX_ERR = """def hello() pass """ DOC_UNDEFINED_NAME_ERR = "a = b" DOC_ENCODING = """# encod...
"invalid syntax"
assert
string_literal
test/plugins/test_pyflakes_lint.py
test_syntax_error_pyflakes
50
null
python-lsp/python-lsp-server
import os import sys import pytest from pylsp import uris from pylsp.lsp import SymbolKind from pylsp.plugins.symbols import pylsp_document_symbols from pylsp.workspace import Document PY2 = sys.version[0] == "2" LINUX = sys.platform.startswith("linux") CI = os.environ.get("CI") DOC_URI = uris.from_fs_path(__file__)...
SymbolKind.Method
assert
complex_expr
test/plugins/test_symbols.py
helper_check_symbols_all_scope
55
null
python-lsp/python-lsp-server
import os import pathlib import pytest from pylsp import uris DOC_URI = uris.from_fs_path(__file__) NOTEBOOK_URI = uris.from_fs_path("notebook_uri") def path_as_uri(path): return pathlib.Path(os.path.abspath(path)).as_uri() def test_multiple_workspaces_from_initialize(pylsp_w_workspace_folders) -> None: py...
2
assert
numeric_literal
test/test_workspace.py
test_multiple_workspaces_from_initialize
88
null
python-lsp/python-lsp-server
import os import sys import pytest from pylsp import uris from pylsp.lsp import SymbolKind from pylsp.plugins.symbols import pylsp_document_symbols from pylsp.workspace import Document PY2 = sys.version[0] == "2" LINUX = sys.platform.startswith("linux") CI = os.environ.get("CI") DOC_URI = uris.from_fs_path(__file__)...
names
assert
variable
test/plugins/test_symbols.py
test_symbols_complex_imports
97
null
python-lsp/python-lsp-server
import os from pylsp import uris from pylsp.plugins.hover import pylsp_hover from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = """ def main(a: float, b: float): \"\"\"hello world\"\"\" pass """ NUMPY_DOC = """ import numpy as np np.sin """ def test_hover(workspace) -> None:...
pylsp_hover(doc._config, doc, no_hov_position)
assert
func_call
test/plugins/test_hover.py
test_hover
89
null
python-lsp/python-lsp-server
import os import sys import pytest from pylsp import uris from pylsp.lsp import SymbolKind from pylsp.plugins.symbols import pylsp_document_symbols from pylsp.workspace import Document PY2 = sys.version[0] == "2" LINUX = sys.platform.startswith("linux") CI = os.environ.get("CI") DOC_URI = uris.from_fs_path(__file__)...
4
assert
numeric_literal
test/plugins/test_symbols.py
test_symbols_complex_imports
94
null
python-lsp/python-lsp-server
from pylsp import uris from pylsp.plugins.type_definition import pylsp_type_definition from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = """\ from dataclasses import dataclass @dataclass class IntPair: a: int b: int def main() -> None: l0 = list(1, 2) my_pair = IntPair...
1
assert
numeric_literal
test/plugins/test_type_definition.py
test_builtin_definition
47
null
python-lsp/python-lsp-server
import os import tempfile from textwrap import dedent from unittest.mock import patch from pylsp import lsp, uris from pylsp.plugins import flake8_lint from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = """import pylsp t = "TEST" def using_const(): \ta = 8 + 9 \treturn t """ def temp_...
{"line": 5, "character": 11}
assert
collection
test/plugins/test_flake8_lint.py
test_flake8_unsaved
42
null
python-lsp/python-lsp-server
import pytest from pylsp import uris from pylsp.plugins import signature from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = """import sys def main(param1, param2): \"\"\" Main docstring Args: param1 (str): Docs for param1 \"\"\" raise Exception() main( """ MUL...
{"kind": "markdown", "value": ""}
assert
collection
test/plugins/test_signature.py
test_signature_without_docstring
120
null
python-lsp/python-lsp-server
import multiprocessing import os import sys import time from threading import Thread from typing import Any from unittest import mock from docstring_to_markdown import UnknownFormatError from flaky import flaky from pylsp import _utils from pylsp.lsp import NotebookCellKind from pylsp.python_lsp import PythonLSPServe...
4
assert
numeric_literal
test/test_utils.py
test_debounce_keyed_by
182
null
python-lsp/python-lsp-server
from pylsp import uris from pylsp.text_edit import OverLappingTextEditException, apply_text_edits DOC_URI = uris.from_fs_path(__file__) def test_apply_text_edits_replace(pylsp) -> None: pylsp.workspace.put_document(DOC_URI, "012345678901234567890123456789") test_doc = pylsp.workspace.get_document(DOC_URI) ...
"012HelloWorld901234567890123456789"
assert
string_literal
test/test_text_edit.py
test_apply_text_edits_replace
130
null
python-lsp/python-lsp-server
import pytest from pylsp import uris from pylsp.plugins import signature from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = """import sys def main(param1, param2): \"\"\" Main docstring Args: param1 (str): Docs for param1 \"\"\" raise Exception() main( """ MUL...
"param1"
assert
string_literal
test/plugins/test_signature.py
test_signature
64
null
python-lsp/python-lsp-server
import os import pathlib import pytest from pylsp import uris DOC_URI = uris.from_fs_path(__file__) NOTEBOOK_URI = uris.from_fs_path("notebook_uri") def path_as_uri(path): return pathlib.Path(os.path.abspath(path)).as_uri() def test_progress_simple(workspace, consumer) -> None: workspace._config.capabiliti...
1
assert
numeric_literal
test/test_workspace.py
test_progress_simple
318
null
python-lsp/python-lsp-server
import os from pylsp import uris from pylsp.plugins.hover import pylsp_hover from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = """ def main(a: float, b: float): \"\"\"hello world\"\"\" pass """ NUMPY_DOC = """ import numpy as np np.sin """ def test_numpy_hover(workspace) ->...
pylsp_hover(doc._config, doc, numpy_hov_position_1)["contents"]["value"]
assert
func_call
test/plugins/test_hover.py
test_numpy_hover
44
null
python-lsp/python-lsp-server
import time from unittest.mock import call, patch import pytest from pylsp import IS_WIN from pylsp.lsp import NotebookCellKind from pylsp.workspace import Notebook from test.test_utils import ( CALL_TIMEOUT_IN_SECONDS, send_initialize_request, send_notebook_did_open, ) def wait_for_condition(condition, ...
0
assert
numeric_literal
test/test_notebook_document.py
test_notebook__did_close
454
null
python-lsp/python-lsp-server
import multiprocessing import os import sys import time from threading import Thread from typing import Any from unittest import mock from docstring_to_markdown import UnknownFormatError from flaky import flaky from pylsp import _utils from pylsp.lsp import NotebookCellKind from pylsp.python_lsp import PythonLSPServe...
2
assert
numeric_literal
test/test_utils.py
test_debounce
148
null
python-lsp/python-lsp-server
import contextlib import os import tempfile from pathlib import Path from pylsp import lsp, uris from pylsp.plugins import pylint_lint from pylsp.workspace import Document, Workspace DOC_URI = uris.from_fs_path(__file__) DOC = """import sys def hello(): \tpass import json """ DOC_SYNTAX_ERR = """def hello() pa...
{"line": 0, "character": 12}
assert
collection
test/plugins/test_pylint_lint.py
test_syntax_error_pylint
78
null
python-lsp/python-lsp-server
import multiprocessing import os import sys import time from threading import Thread from typing import Any from unittest import mock from docstring_to_markdown import UnknownFormatError from flaky import flaky from pylsp import _utils from pylsp.lsp import NotebookCellKind from pylsp.python_lsp import PythonLSPServe...
"a,r,r,a,y"
assert
string_literal
test/test_utils.py
test_list_to_string
187
null
python-lsp/python-lsp-server
import os from pylsp import uris from pylsp.plugins.definition import pylsp_definitions from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = """def a(): pass print(a()) class Directory(object): def __init__(self): self.members = dict() def add_member(self, id, name)...
0
assert
numeric_literal
test/plugins/test_definitions.py
test_numpy_definition
100
null
python-lsp/python-lsp-server
import os import sys import pytest from pylsp import uris from pylsp.lsp import SymbolKind from pylsp.plugins.symbols import pylsp_document_symbols from pylsp.workspace import Document PY2 = sys.version[0] == "2" LINUX = sys.platform.startswith("linux") CI = os.environ.get("CI") DOC_URI = uris.from_fs_path(__file__)...
SymbolKind.Variable
assert
complex_expr
test/plugins/test_symbols.py
helper_check_symbols_all_scope
53
null
python-lsp/python-lsp-server
import os import pytest from pylsp import uris from pylsp.plugins.references import pylsp_references from pylsp.workspace import Document DOC1_NAME = "test1.py" DOC2_NAME = "test2.py" DOC1 = """class Test1(): pass """ DOC2 = """from test1 import Test1 try: Test1() except UnicodeError: pass """ def tm...
{"line": 3, "character": 4}
assert
collection
test/plugins/test_references.py
test_references
64
null
python-lsp/python-lsp-server
import time from unittest.mock import call, patch import pytest from pylsp import IS_WIN from pylsp.lsp import NotebookCellKind from pylsp.workspace import Notebook from test.test_utils import ( CALL_TIMEOUT_IN_SECONDS, send_initialize_request, send_notebook_did_open, ) def wait_for_condition(condition, ...
1
assert
numeric_literal
test/test_notebook_document.py
test_notebook_document__did_change
253
null
python-lsp/python-lsp-server
import math import os import sys from pathlib import Path from typing import NamedTuple import pytest from pylsp import lsp, uris from pylsp._utils import JEDI_VERSION from pylsp.plugins.jedi_completion import ( pylsp_completion_item_resolve as pylsp_jedi_completion_item_resolve, ) from pylsp.plugins.jedi_complet...
"loghub"
assert
string_literal
test/plugins/test_completion.py
test_jedi_completion_environment
536
null
python-lsp/python-lsp-server
import sys from pylsp import lsp, uris from pylsp.plugins import pyflakes_lint from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = """import sys def hello(): \tpass import json """ DOC_SYNTAX_ERR = """def hello() pass """ DOC_UNDEFINED_NAME_ERR = "a = b" DOC_ENCODING = """# encod...
lsp.DiagnosticSeverity.Error
assert
complex_expr
test/plugins/test_pyflakes_lint.py
test_syntax_error_pyflakes
52
null
python-lsp/python-lsp-server
import pytest from pylsp import uris from test import unix_only, windows_only @pytest.mark.parametrize( "uri,kwargs,new_uri", [ ("file:///foo/bar", {"path": "/baz/boo"}, "file:///baz/boo"), ( "file:///D:/hello%20world.py", {"path": "D:/hello universe.py"}, "...
new_uri
assert
variable
test/test_uris.py
test_uri_with
72
null
python-lsp/python-lsp-server
from pylsp import uris from pylsp.text_edit import OverLappingTextEditException, apply_text_edits DOC_URI = uris.from_fs_path(__file__) def test_apply_text_edits_multiline(pylsp) -> None: pylsp.workspace.put_document(DOC_URI, "0\n1\n2\n3\n4") test_doc = pylsp.workspace.get_document(DOC_URI) assert
"0\n1World\nHello3\n4"
assert
string_literal
test/test_text_edit.py
test_apply_text_edits_multiline
282
null
python-lsp/python-lsp-server
import multiprocessing import os import sys import time from threading import Thread from typing import Any from unittest import mock from docstring_to_markdown import UnknownFormatError from flaky import flaky from pylsp import _utils from pylsp.lsp import NotebookCellKind from pylsp.python_lsp import PythonLSPServe...
{"a": False, "b": {"x": 123, "y": [], "z": 987}}
assert
collection
test/test_utils.py
test_merge_dicts
201
null
python-lsp/python-lsp-server
import os import pathlib import pytest from pylsp import uris DOC_URI = uris.from_fs_path(__file__) NOTEBOOK_URI = uris.from_fs_path("notebook_uri") def path_as_uri(path): return pathlib.Path(os.path.abspath(path)).as_uri() def test_multiple_workspaces_from_initialize(pylsp_w_workspace_folders) -> None: py...
pylsp.workspaces
assert
complex_expr
test/test_workspace.py
test_multiple_workspaces_from_initialize
93
null
python-lsp/python-lsp-server
import os import pytest from pylsp import lsp, uris from pylsp.plugins import pycodestyle_lint from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = """import sys def hello( ): \tpass print("hello" ,"world" ) import json """ @pytest.mark.parametrize("newline", ["\r\n", "\r"]) def tes...
0
assert
numeric_literal
test/plugins/test_pycodestyle_lint.py
test_line_endings
136
null
python-lsp/python-lsp-server
from pylsp import uris from pylsp.text_edit import OverLappingTextEditException, apply_text_edits DOC_URI = uris.from_fs_path(__file__) def test_apply_text_edits_insert(pylsp) -> None: pylsp.workspace.put_document(DOC_URI, "012345678901234567890123456789") test_doc = pylsp.workspace.get_document(DOC_URI) ...
"0HelloWorld1OneTwoThree2345678901234567890123456789"
assert
string_literal
test/test_text_edit.py
test_apply_text_edits_insert
66
null
python-lsp/python-lsp-server
import sys from pylsp import lsp, uris from pylsp.plugins import pyflakes_lint from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = """import sys def hello(): \tpass import json """ DOC_SYNTAX_ERR = """def hello() pass """ DOC_UNDEFINED_NAME_ERR = "a = b" DOC_ENCODING = """# encod...
1
assert
numeric_literal
test/plugins/test_pyflakes_lint.py
test_unicode_encoding
68
null
python-lsp/python-lsp-server
import pytest from pylsp import uris from pylsp.plugins import signature from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = """import sys def main(param1, param2): \"\"\" Main docstring Args: param1 (str): Docs for param1 \"\"\" raise Exception() main( """ MUL...
"test"
assert
string_literal
test/plugins/test_signature.py
test_docstring_params
105
null
python-lsp/python-lsp-server
import os import tempfile from textwrap import dedent from unittest.mock import patch from pylsp import lsp, uris from pylsp.plugins import flake8_lint from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = """import pylsp t = "TEST" def using_const(): \ta = 8 + 9 \treturn t """ def temp_...
"F841"
assert
string_literal
test/plugins/test_flake8_lint.py
test_flake8_unsaved
40
null
python-lsp/python-lsp-server
import os import tempfile from textwrap import dedent from unittest.mock import patch from pylsp import lsp, uris from pylsp.plugins import flake8_lint from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = """import pylsp t = "TEST" def using_const(): \ta = 8 + 9 \treturn t """ def temp_...
"flake8"
assert
string_literal
test/plugins/test_flake8_lint.py
test_flake8_unsaved
39
null
python-lsp/python-lsp-server
from pylsp.workspace import Document from test.fixtures import DOC, DOC_URI def test_document_props(doc) -> None: assert doc.uri ==
DOC_URI
assert
variable
test/test_document.py
test_document_props
9
null
python-lsp/python-lsp-server
import pytest from pylsp import uris from pylsp.plugins.yapf_format import pylsp_format_document, pylsp_format_range from pylsp.text_edit import apply_text_edits from pylsp.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = """A = [ 'h', 'w', 'a' ] B = ['h', 'w'] """ GOOD_DOC =...
FOUR_SPACE_DOC.replace(" ", "\t")
assert
func_call
test/plugins/test_yapf_format.py
test_format_with_insert_spaces_option
93
null
python-lsp/python-lsp-server
from pylsp.workspace import Document from test.fixtures import DOC, DOC_URI def test_word_at_position(doc) -> None: """Return the position under the cursor (or last in line if past the end)""" # import sys assert doc.word_at_position({"line": 0, "character": 8}) == "sys" # Past end of import sys as...
""
assert
string_literal
test/test_document.py
test_word_at_position
39
null