mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-12 17:46:19 +00:00
This package will be used in Pybricks Code to provide some intellesense operations.
127 lines
2.4 KiB
Python
127 lines
2.4 KiB
Python
# SPDX-License-Identifier: MIT
|
|
# Copyright (c) 2022 The Pybricks Authors
|
|
|
|
"""
|
|
Tests for correct code completion of builtins.
|
|
"""
|
|
|
|
|
|
import json
|
|
from pybricks_jedi import CompletionItem, complete
|
|
|
|
|
|
def test_empty_code():
|
|
code = ""
|
|
completions: list[CompletionItem] = json.loads(complete(code, 1, 1))
|
|
# since nothing has been imported, this is just all builtins and keywords
|
|
assert [c["insertText"] for c in completions] == [
|
|
"abs",
|
|
"all",
|
|
"any",
|
|
"ArithmeticError",
|
|
"assert",
|
|
"AssertionError",
|
|
"async",
|
|
"AttributeError",
|
|
"await",
|
|
"BaseException",
|
|
"bin",
|
|
"bool",
|
|
"break",
|
|
"bytearray",
|
|
"bytes",
|
|
"callable",
|
|
"chr",
|
|
"class",
|
|
"classmethod",
|
|
"complex",
|
|
"continue",
|
|
"def",
|
|
"del",
|
|
"dict",
|
|
"dir",
|
|
"divmod",
|
|
"enumerate",
|
|
"EOFError",
|
|
"eval",
|
|
"Exception",
|
|
"exec",
|
|
"False",
|
|
"float",
|
|
"for",
|
|
"from",
|
|
"GeneratorExit",
|
|
"getattr",
|
|
"global",
|
|
"globals",
|
|
"hasattr",
|
|
"hash",
|
|
"help",
|
|
"hex",
|
|
"id",
|
|
"if",
|
|
"import",
|
|
"ImportError",
|
|
"IndentationError",
|
|
"IndexError",
|
|
"input",
|
|
"int",
|
|
"isinstance",
|
|
"issubclass",
|
|
"iter",
|
|
"KeyboardInterrupt",
|
|
"KeyError",
|
|
"lambda",
|
|
"len",
|
|
"list",
|
|
"locals",
|
|
"LookupError",
|
|
"map",
|
|
"max",
|
|
"MemoryError",
|
|
"min",
|
|
"NameError",
|
|
"next",
|
|
"None",
|
|
"nonlocal",
|
|
"not",
|
|
"NotImplementedError",
|
|
"object",
|
|
"oct",
|
|
"ord",
|
|
"OSError",
|
|
"OverflowError",
|
|
"pass",
|
|
"pow",
|
|
"print",
|
|
"raise",
|
|
"range",
|
|
"repr",
|
|
"return",
|
|
"reversed",
|
|
"round",
|
|
"RuntimeError",
|
|
"set",
|
|
"setattr",
|
|
"slice",
|
|
"sorted",
|
|
"staticmethod",
|
|
"StopIteration",
|
|
"str",
|
|
"sum",
|
|
"super",
|
|
"SyntaxError",
|
|
"SystemExit",
|
|
"True",
|
|
"try",
|
|
"tuple",
|
|
"type",
|
|
"TypeError",
|
|
"ValueError",
|
|
"while",
|
|
"with",
|
|
"yield",
|
|
"ZeroDivisionError",
|
|
"zip",
|
|
]
|