This commit is contained in:
Benjamin Schaaf
2022-01-02 20:40:07 +11:00
parent 87d32ddc7f
commit 5c4a29e6ae
16 changed files with 604 additions and 545 deletions

19
tests/ui_actions_test.py Normal file
View File

@@ -0,0 +1,19 @@
from typing import Any, List, Tuple, Optional, Union, Dict
from sublime_music.ui import actions
def test_variant_type_from_python():
assert actions.variant_type_from_python(bool) == 'b'
assert actions.variant_type_from_python(int) == 'x'
assert actions.variant_type_from_python(float) == 'd'
assert actions.variant_type_from_python(str) == 's'
assert actions.variant_type_from_python(Any) == 'v'
assert actions.variant_type_from_python(List[int]) == 'ax'
assert actions.variant_type_from_python(Tuple[str, int, bool]) == '(sxb)'
assert actions.variant_type_from_python(Optional[str]) == 'ms'
assert actions.variant_type_from_python(Union[str, int]) == '[sx]'
assert actions.variant_type_from_python(Dict[str, int]) == 'a{sx}'
assert (actions.variant_type_from_python(
Tuple[Dict[Optional[str], List[bool]], List[List[Any]]])
== '(a{msab}aav)')