mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-07-28 04:07:46 +00:00
jedi: Add ustruct, json modules.
This commit is contained in:
@@ -21,9 +21,11 @@ PYBRICKS_CODE_PACKAGES = {
|
||||
"pybricks.tools",
|
||||
"uerrno",
|
||||
"uio",
|
||||
"ujson",
|
||||
"umath",
|
||||
"urandom",
|
||||
"uselect",
|
||||
"ustruct",
|
||||
"usys",
|
||||
}
|
||||
|
||||
|
||||
@@ -18,9 +18,11 @@ def test_from():
|
||||
"pybricks",
|
||||
"uerrno",
|
||||
"uio",
|
||||
"ujson",
|
||||
"umath",
|
||||
"urandom",
|
||||
"uselect",
|
||||
"ustruct",
|
||||
"usys",
|
||||
]
|
||||
|
||||
@@ -186,6 +188,19 @@ def test_from_uio_import():
|
||||
]
|
||||
|
||||
|
||||
def test_from_ujson_import():
|
||||
code = "from ujson import "
|
||||
completions: list[CompletionItem] = json.loads(complete(code, 1, len(code) + 1))
|
||||
assert [c["insertText"] for c in completions] == [
|
||||
"decode", # FIXME: Shouldn't be here
|
||||
"dump",
|
||||
"dumps",
|
||||
"encode", # FIXME: Shouldn't be here
|
||||
"load",
|
||||
"loads",
|
||||
]
|
||||
|
||||
|
||||
def test_from_umath_import():
|
||||
code = "from umath import "
|
||||
completions: list[CompletionItem] = json.loads(complete(code, 1, len(code) + 1))
|
||||
@@ -247,6 +262,18 @@ def test_from_uselect_import():
|
||||
]
|
||||
|
||||
|
||||
def test_from_ustruct_import():
|
||||
code = "from ustruct import "
|
||||
completions: list[CompletionItem] = json.loads(complete(code, 1, len(code) + 1))
|
||||
assert [c["insertText"] for c in completions] == [
|
||||
"calcsize",
|
||||
"pack",
|
||||
"pack_into",
|
||||
"unpack",
|
||||
"unpack_from",
|
||||
]
|
||||
|
||||
|
||||
def test_from_usys_import():
|
||||
code = "from usys import "
|
||||
completions: list[CompletionItem] = json.loads(complete(code, 1, len(code) + 1))
|
||||
|
||||
@@ -18,9 +18,11 @@ packages = [
|
||||
{ include = "micropython", from = "src" },
|
||||
{ include = "uerrno", from = "src" },
|
||||
{ include = "uio", from = "src" },
|
||||
{ include = "ujson", from = "src" },
|
||||
{ include = "umath", from = "src" },
|
||||
{ include = "urandom", from = "src" },
|
||||
{ include = "uselect", from = "src" },
|
||||
{ include = "ustruct", from = "src" },
|
||||
{ include = "usys", from = "src" },
|
||||
]
|
||||
|
||||
|
||||
@@ -11,10 +11,6 @@ Convert between Python objects and the JSON data format.
|
||||
|
||||
from typing import IO, Any, Tuple
|
||||
|
||||
import json
|
||||
|
||||
json.dump
|
||||
|
||||
|
||||
def dump(object: Any, stream: IO, separators: Tuple[str, str] = (", ", ": ")):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user