Files
pybricks-api/jedi/tests/test_complete_builtins.py
T
David Lechner a2d9c33eb5 jedi: add new pybricks_jedi package
This package will be used in Pybricks Code to provide some intellesense
operations.
2022-06-24 14:52:45 -05:00

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",
]