mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-09-01 20:08:57 +00:00
* core: do not commit refused name changes * feat(python): add error base and missing commands * feat(python): let callers drive startup themselves * style(python): satisfy the linter, skip generated types * feat(python): expose the message of a command error * core: update query plans * core: fix the batch limit parse error on GHC 8.10 * feat(python): reject profile images no client can render
42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
"""Sanity checks on auto-generated wire types — catches generator regressions."""
|
|
|
|
import typing
|
|
|
|
from simplex_chat.types import CC, CR, CEvt, T
|
|
|
|
|
|
def test_types_module_imports():
|
|
"""Every generated module imports cleanly with no SyntaxError."""
|
|
assert T is not None and CC is not None and CR is not None and CEvt is not None
|
|
|
|
|
|
def test_chat_type_is_literal_enum():
|
|
"""ChatType should be a Literal of expected member set."""
|
|
args = typing.get_args(T.ChatType)
|
|
assert "direct" in args
|
|
assert "group" in args
|
|
assert "local" in args
|
|
|
|
|
|
def test_known_command_has_cmd_string():
|
|
s = CC.APICreateMyAddress_cmd_string({"userId": 1})
|
|
assert s == "/_address 1"
|
|
|
|
|
|
def test_chat_response_tag_alias_present():
|
|
"""ChatResponse_Tag union of literals exists."""
|
|
assert hasattr(CR, "ChatResponse_Tag")
|
|
|
|
|
|
def test_chat_event_tag_alias_present():
|
|
"""ChatEvent_Tag exists; covers the on_event Literal annotation."""
|
|
assert hasattr(CEvt, "ChatEvent_Tag")
|
|
args = typing.get_args(CEvt.ChatEvent_Tag)
|
|
assert "newChatItems" in args
|
|
|
|
|
|
def test_chat_ref_cmd_string_direct():
|
|
"""Sanity check the codegen fix for ChatRef-bearing commands."""
|
|
assert T.ChatRef_cmd_string({"chatType": "direct", "chatId": 7}) == "@7"
|
|
assert T.ChatRef_cmd_string({"chatType": "group", "chatId": 42}) == "#42"
|