20 lines
907 B
Python
20 lines
907 B
Python
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)')
|