forked from VimPlug/jedi
Add tests for DefaultDict support.
This commit is contained in:
committed by
Dave Halter
parent
55941e506b
commit
e96ebbe88f
@@ -129,11 +129,12 @@ class Key:
|
|||||||
class Value:
|
class Value:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def mapping(p, q, d, r, s, t):
|
def mapping(p, q, d, dd, r, s, t):
|
||||||
"""
|
"""
|
||||||
:type p: typing.Mapping[Key, Value]
|
:type p: typing.Mapping[Key, Value]
|
||||||
:type q: typing.MutableMapping[Key, Value]
|
:type q: typing.MutableMapping[Key, Value]
|
||||||
:type d: typing.Dict[Key, Value]
|
:type d: typing.Dict[Key, Value]
|
||||||
|
:type dd: typing.DefaultDict[Key, Value]
|
||||||
:type r: typing.KeysView[Key]
|
:type r: typing.KeysView[Key]
|
||||||
:type s: typing.ValuesView[Value]
|
:type s: typing.ValuesView[Value]
|
||||||
:type t: typing.ItemsView[Key, Value]
|
:type t: typing.ItemsView[Key, Value]
|
||||||
@@ -144,6 +145,8 @@ def mapping(p, q, d, r, s, t):
|
|||||||
q.setd
|
q.setd
|
||||||
#? ["setdefault"]
|
#? ["setdefault"]
|
||||||
d.setd
|
d.setd
|
||||||
|
#? ["setdefault"]
|
||||||
|
dd.setd
|
||||||
#? Value()
|
#? Value()
|
||||||
p[1]
|
p[1]
|
||||||
for key in p:
|
for key in p:
|
||||||
@@ -241,6 +244,36 @@ for value in x.values():
|
|||||||
#? int()
|
#? int()
|
||||||
value
|
value
|
||||||
# python >= 3.2
|
# python >= 3.2
|
||||||
|
|
||||||
|
class TestDefaultDict(typing.DefaultDict[str, int]):
|
||||||
|
def setdud(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def testdict(x):
|
||||||
|
"""
|
||||||
|
:type x: TestDefaultDict
|
||||||
|
"""
|
||||||
|
#? ["setdud", "setdefault"]
|
||||||
|
x.setd
|
||||||
|
for key in x.keys():
|
||||||
|
#? str()
|
||||||
|
key
|
||||||
|
for value in x.values():
|
||||||
|
#? int()
|
||||||
|
value
|
||||||
|
|
||||||
|
x = TestDefaultDict()
|
||||||
|
#? ["setdud", "setdefault"]
|
||||||
|
x.setd
|
||||||
|
for key in x.keys():
|
||||||
|
#? str()
|
||||||
|
key
|
||||||
|
for value in x.values():
|
||||||
|
#? int()
|
||||||
|
value
|
||||||
|
# python >= 3.2
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
docstrings have some auto-import, annotations can use all of Python's
|
docstrings have some auto-import, annotations can use all of Python's
|
||||||
import logic
|
import logic
|
||||||
|
|||||||
Reference in New Issue
Block a user