From d09279e0adb97872cff10a41236d15f1dc422e3c Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Thu, 31 Jul 2014 15:16:24 +0200 Subject: [PATCH] change tests that provided wrong instance information --- jedi/api/classes.py | 2 ++ test/completion/basic.py | 4 ++-- test/completion/decorators.py | 4 ++-- test/completion/docstring.py | 2 +- test/completion/functions.py | 6 +++--- test/completion/isinstance.py | 4 ++-- test/completion/ordering.py | 4 ++-- test/completion/stdlib.py | 2 +- 8 files changed, 15 insertions(+), 13 deletions(-) diff --git a/jedi/api/classes.py b/jedi/api/classes.py index 37d65c18..ab1134b2 100644 --- a/jedi/api/classes.py +++ b/jedi/api/classes.py @@ -148,6 +148,8 @@ class BaseDefinition(object): stripped = stripped.parent if isinstance(stripped, pr.Name): stripped = stripped.parent + if isinstance(stripped, iterable.Array): + return 'instance' return type(stripped).__name__.lower().replace('wrapper', '') def _path(self): diff --git a/test/completion/basic.py b/test/completion/basic.py index edd8ca24..80874e85 100644 --- a/test/completion/basic.py +++ b/test/completion/basic.py @@ -51,7 +51,7 @@ func() assert [] def focus_return(): - #? list + #? list() return [] @@ -163,7 +163,7 @@ def listen(arg): x listen(['' for x in [1]]) -#? str() +#? str ([str for x in []])[0] diff --git a/test/completion/decorators.py b/test/completion/decorators.py index 4165b22e..73ac4719 100644 --- a/test/completion/decorators.py +++ b/test/completion/decorators.py @@ -31,7 +31,7 @@ def fu(a, b, c, *args, **kwargs): exe = fu(list, c=set, b=3, d='') -#? list() +#? list exe[0] #? int() exe[1] @@ -63,7 +63,7 @@ def fu2(a, b, c, *args, **kwargs): exe = fu2(list, c=set, b=3, d='str') -#? list() +#? list exe[0] #? int() exe[1] diff --git a/test/completion/docstring.py b/test/completion/docstring.py index f80fea31..95088323 100644 --- a/test/completion/docstring.py +++ b/test/completion/docstring.py @@ -148,7 +148,7 @@ def both(): """ return 23 -#? str(), int() +#? str() int() both() class Test(object): diff --git a/test/completion/functions.py b/test/completion/functions.py index be3b5853..7a82477c 100644 --- a/test/completion/functions.py +++ b/test/completion/functions.py @@ -237,7 +237,7 @@ exe = args_func(1, "", list) exe[0] #? tuple() exe[1] -#? list() +#? list exe[1][1] @@ -306,7 +306,7 @@ def fu(a=1, b="", *args, **kwargs): exe = fu(list, 1, "", c=set, d="") -#? list() +#? list exe[0] #? int() exe[1] @@ -316,7 +316,7 @@ exe[2] exe[2][0] #? dict() exe[3] -#? set() +#? set exe[3]['c'] # ----------------- diff --git a/test/completion/isinstance.py b/test/completion/isinstance.py index 9733efef..c5b776f1 100644 --- a/test/completion/isinstance.py +++ b/test/completion/isinstance.py @@ -38,7 +38,7 @@ import datetime def fooooo(obj): if isinstance(obj, datetime.datetime): - #? datetime.datetime + #? datetime.datetime() obj @@ -48,7 +48,7 @@ def fooooo2(obj): else: return 1 -#? int() datetime.datetime +#? int() datetime.datetime() fooooo2('') diff --git a/test/completion/ordering.py b/test/completion/ordering.py index a6a4f172..32a85845 100644 --- a/test/completion/ordering.py +++ b/test/completion/ordering.py @@ -103,8 +103,8 @@ class A(object): def before(self): self.b = 3 - # TODO should this be so? - #? int() str() list() + # TODO should this be so? include entries after cursor? + #? int() str() list self.b self.b = list diff --git a/test/completion/stdlib.py b/test/completion/stdlib.py index 2b488e4b..e2351887 100644 --- a/test/completion/stdlib.py +++ b/test/completion/stdlib.py @@ -64,7 +64,7 @@ import weakref #? int() weakref.proxy(1) -#? weakref.ref +#? weakref.ref() weakref.ref(1) #? int() weakref.ref(1)()