Skip to content

Commit 1189df8

Browse files
committed
Improve test
1 parent e7e7e74 commit 1189df8

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

atest/moc_library_py3.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
from typing import Optional
2+
3+
14
class MockLibraryPy3:
25

36
def named_only(self, *varargs, key1, key2):
@@ -11,3 +14,6 @@ def args_with_type_hints(self, arg1, arg2, arg3: str, arg4: None) -> bool:
1114

1215
def self_and_keyword_only_types(x: 'MockLibraryPy3', mandatory, *varargs: int, other: bool, **kwargs: int):
1316
pass
17+
18+
def optional_none(self, arg: Optional[str] = None):
19+
pass

utest/test_keyword_builder.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from robotlibcore import PY2, RF31, KeywordBuilder
44
from moc_library import MockLibrary
55
if not PY2:
6+
from typing import Union
67
from moc_library_py3 import MockLibraryPy3
78

89

@@ -99,6 +100,12 @@ def test_types_(lib_py3):
99100

100101

101102
@pytest.mark.skipif(PY2, reason='Only for Python 3')
102-
def test_types_(lib_py3):
103+
def test_types(lib_py3):
103104
spec = KeywordBuilder.build(lib_py3.self_and_keyword_only_types)
104105
assert spec.argument_types == {'varargs': int, 'other': bool, 'kwargs': int}
106+
107+
108+
@pytest.mark.skipif(PY2, reason='Only for Python 3')
109+
def test_optional_none(lib_py3):
110+
spec = KeywordBuilder.build(lib_py3.optional_none)
111+
assert spec.argument_types == {'arg': Union[str, None]}

0 commit comments

Comments
 (0)