From 7e449af4bd6c8863419c38e418100f0ae01f615a Mon Sep 17 00:00:00 2001 From: Hugo Date: Sun, 7 Jan 2018 10:33:24 +0200 Subject: [PATCH] Revert changes to test/completion and test/static_analysis except for 2.6 comment removal --- test/completion/arrays.py | 30 ++++++++++---------- test/completion/async_.py | 2 +- test/completion/basic.py | 10 +++---- test/completion/classes.py | 32 +++++++++++----------- test/completion/comprehensions.py | 2 +- test/completion/context.py | 4 +-- test/completion/decorators.py | 14 +++++----- test/completion/descriptors.py | 8 +++--- test/completion/docstring.py | 10 +++---- test/completion/dynamic_arrays.py | 14 +++++----- test/completion/dynamic_params.py | 4 +-- test/completion/flow_analysis.py | 4 +-- test/completion/functions.py | 2 +- test/completion/generators.py | 2 +- test/completion/goto.py | 10 +++---- test/completion/import_tree/classes.py | 4 +-- test/completion/invalid.py | 2 +- test/completion/isinstance.py | 2 +- test/completion/lambdas.py | 2 +- test/completion/ordering.py | 4 +-- test/completion/parser.py | 2 +- test/completion/pep0484_basic.py | 2 +- test/completion/recursion.py | 4 +-- test/completion/stdlib.py | 2 +- test/completion/usages.py | 8 +++--- test/static_analysis/attribute_error.py | 4 +-- test/static_analysis/attribute_warnings.py | 4 +-- test/static_analysis/class_simple.py | 2 +- test/static_analysis/descriptors.py | 2 +- test/static_analysis/normal_arguments.py | 2 +- test/static_analysis/star_arguments.py | 2 +- test/static_analysis/try_except.py | 2 +- 32 files changed, 99 insertions(+), 99 deletions(-) diff --git a/test/completion/arrays.py b/test/completion/arrays.py index 19c6222f..e44a0671 100644 --- a/test/completion/arrays.py +++ b/test/completion/arrays.py @@ -43,7 +43,7 @@ b[int():] b[:] -class _StrangeSlice: +class _StrangeSlice(): def __getitem__(self, sliced): return sliced @@ -128,25 +128,25 @@ f # ----------------- # unnessecary braces # ----------------- -a = 1 +a = (1) #? int() a #? int() -1 -#? int() (1) #? int() -(1 + 1) +((1)) +#? int() +((1)+1) u, v = 1, "" #? int() u -(u1, v1) = 1, "" +((u1, v1)) = 1, "" #? int() u1 #? int() -u1 +(u1) (a), b = 1, '' #? int() @@ -154,15 +154,15 @@ a def a(): return '' #? str() -a() +(a)() #? str() -a().replace() +(a)().replace() #? int() -tuple.index() +(tuple).index() #? int() -tuple().index() +(tuple)().index() -class C: +class C(): def __init__(self): self.a = (str()).upper() @@ -283,14 +283,14 @@ dic2[index] # __getitem__ # ----------------- -class GetItem: +class GetItem(): def __getitem__(self, index): return 1.0 #? float() GetItem()[0] -class GetItem: +class GetItem(): def __init__(self, el): self.el = el @@ -300,7 +300,7 @@ class GetItem: #? str() GetItem("")[1] -class GetItemWithList: +class GetItemWithList(): def __getitem__(self, index): return [1, 1.0, 's'][index] diff --git a/test/completion/async_.py b/test/completion/async_.py index a63e93ab..b2202137 100644 --- a/test/completion/async_.py +++ b/test/completion/async_.py @@ -24,7 +24,7 @@ async def x2(): #? ['readlines'] f.readlines -class A: +class A(): @staticmethod async def b(c=1, d=2): return 1 diff --git a/test/completion/basic.py b/test/completion/basic.py index efe30c78..d79a15ed 100644 --- a/test/completion/basic.py +++ b/test/completion/basic.py @@ -23,9 +23,9 @@ a(0):. # if/else/elif # ----------------- -if random.choice([0, 1]): +if (random.choice([0, 1])): 1 -elif random.choice([0, 1]): +elif(random.choice([0, 1])): a = 3 else: a = '' @@ -34,7 +34,7 @@ a def func(): if random.choice([0, 1]): 1 - elif random.choice([0, 1]): + elif(random.choice([0, 1])): a = 3 else: a = '' @@ -187,7 +187,7 @@ some_word # ----------------- class A(object): pass -class B: pass +class B(): pass #? ['__init__'] A.__init__ @@ -201,7 +201,7 @@ int().__init__ # comments # ----------------- -class A: +class A(): def __init__(self): self.hello = {} # comment shouldn't be a string #? dict() diff --git a/test/completion/classes.py b/test/completion/classes.py index fa09a038..292cfc36 100644 --- a/test/completion/classes.py +++ b/test/completion/classes.py @@ -6,7 +6,7 @@ def find_class(): #? ['ret'] TestClass.ret -class FindClass: +class FindClass(): #? [] TestClass.ret if a: @@ -125,7 +125,7 @@ strs.second TestClass.var_class.var_class.var_class.var_class # operations (+, *, etc) shouldn't be InstanceElements - #246 -class A: +class A(): def __init__(self): self.addition = 1 + 2 #? int() @@ -219,7 +219,7 @@ class Dude(classgetter()): # __call__ # ----------------- -class CallClass: +class CallClass(): def __call__(self): return 1 @@ -256,7 +256,7 @@ V(1).d() # ----------------- # ordering # ----------------- -class A: +class A(): def b(self): #? int() a_func() @@ -278,8 +278,8 @@ A().a_func() # ----------------- # nested classes # ----------------- -class A: - class B: +class A(): + class B(): pass def b(self): return 1.0 @@ -287,9 +287,9 @@ class A: #? float() A().b() -class A: +class A(): def b(self): - class B: + class B(): def b(self): return [] return B().b() @@ -304,7 +304,7 @@ A().b() def meth(self): return self.a, self.b -class WithoutMethod: +class WithoutMethod(): a = 1 def __init__(self): self.b = 1.0 @@ -312,7 +312,7 @@ class WithoutMethod: return self.b m = meth -class B: +class B(): b = '' a = WithoutMethod().m() @@ -348,18 +348,18 @@ getattr(getattr, 1) getattr(str, []) -class Base: +class Base(): def ret(self, b): return b -class Wrapper: +class Wrapper(): def __init__(self, obj): self.obj = obj def __getattr__(self, name): return getattr(self.obj, name) -class Wrapper2: +class Wrapper2(): def __getattribute__(self, name): return getattr(Base(), name) @@ -369,7 +369,7 @@ Wrapper(Base()).ret(3) #? int() Wrapper2(Base()).ret(3) -class GetattrArray: +class GetattrArray(): def __getattr__(self, name): return [1] @@ -380,7 +380,7 @@ GetattrArray().something[0] # ----------------- # private vars # ----------------- -class PrivateVar: +class PrivateVar(): def __init__(self): self.__var = 1 #? int() @@ -517,7 +517,7 @@ Config.mode2 class Foo(object): a = 3 def create_class(self): - class X: + class X(): a = self.a self.b = 3.0 return X diff --git a/test/completion/comprehensions.py b/test/completion/comprehensions.py index db9e3178..402ef753 100644 --- a/test/completion/comprehensions.py +++ b/test/completion/comprehensions.py @@ -154,7 +154,7 @@ foo[1] # In class # ----------------- -class X: +class X(): def __init__(self, bar): self.bar = bar diff --git a/test/completion/context.py b/test/completion/context.py index f26ff0a6..d3e79b81 100644 --- a/test/completion/context.py +++ b/test/completion/context.py @@ -1,4 +1,4 @@ -class Base: +class Base(): myfoobar = 3 @@ -35,7 +35,7 @@ myfoobar # Inheritance # ----------------- -class Super: +class Super(): enabled = True if enabled: yo_dude = 4 diff --git a/test/completion/decorators.py b/test/completion/decorators.py index 099c12c5..27e455ae 100644 --- a/test/completion/decorators.py +++ b/test/completion/decorators.py @@ -106,7 +106,7 @@ def nothing(a,b,c): #? int() nothing("")[0] -class MethodDecoratorAsClass: +class MethodDecoratorAsClass(): class_var = 3 @Decorator def func_without_self(arg, arg2): @@ -124,7 +124,7 @@ MethodDecoratorAsClass().func_without_self('')[1] MethodDecoratorAsClass().func_with_self(1) -class SelfVars: +class SelfVars(): """Init decorator problem as an instance, #247""" @Decorator def __init__(self): @@ -181,7 +181,7 @@ JustAClass.a() # illegal decorators # ----------------- -class DecoratorWithoutCall: +class DecoratorWithoutCall(): def __init__(self, func): self.func = func @@ -200,7 +200,7 @@ f() g() -class X: +class X(): @str def x(self): pass @@ -220,7 +220,7 @@ def dec(f): return f(s) return wrapper -class MethodDecorators: +class MethodDecorators(): _class_var = 1 def __init__(self): self._method_var = '' @@ -245,7 +245,7 @@ MethodDecorators().class_var() MethodDecorators().method_var() -class Base: +class Base(): @not_existing def __init__(self): pass @@ -298,7 +298,7 @@ follow_statement(1) # class decorators should just be ignored @should_ignore -class A: +class A(): def ret(self): return 1 diff --git a/test/completion/descriptors.py b/test/completion/descriptors.py index 3f1674a4..3cc01faf 100644 --- a/test/completion/descriptors.py +++ b/test/completion/descriptors.py @@ -50,7 +50,7 @@ C.just_a_method # ----------------- # properties # ----------------- -class B: +class B(): @property def r(self): return 1 @@ -71,7 +71,7 @@ B().p #? [] B().p(). -class PropClass: +class PropClass(): def __init__(self, a): self.a = a @property @@ -190,7 +190,7 @@ E.u(1) from functools import partial -class Memoize: +class Memoize(): def __init__(self, func): self.func = func @@ -205,7 +205,7 @@ class Memoize: return self.func(*args, **kwargs) -class MemoizeTest: +class MemoizeTest(): def __init__(self, x): self.x = x diff --git a/test/completion/docstring.py b/test/completion/docstring.py index 1e2d68ed..88db52d1 100644 --- a/test/completion/docstring.py +++ b/test/completion/docstring.py @@ -61,7 +61,7 @@ def sphinxy_param_type_wrapped(a): # local classes -> github #370 -class ProgramNode: +class ProgramNode(): pass def local_classes(node, node2): @@ -75,7 +75,7 @@ def local_classes(node, node2): #? ProgramNode2() node2 -class ProgramNode2: +class ProgramNode2(): pass @@ -193,7 +193,7 @@ d.upper() # class docstrings # ----------------- -class InInit: +class InInit(): def __init__(self, foo): """ :type foo: str @@ -202,7 +202,7 @@ class InInit: foo -class InClass: +class InClass(): """ :type foo: str """ @@ -211,7 +211,7 @@ class InClass: foo -class InBoth: +class InBoth(): """ :type foo: str """ diff --git a/test/completion/dynamic_arrays.py b/test/completion/dynamic_arrays.py index 046b91ea..5cb52fc6 100644 --- a/test/completion/dynamic_arrays.py +++ b/test/completion/dynamic_arrays.py @@ -6,7 +6,7 @@ Checking for ``list.append`` and all the other possible array modifications. # ----------------- arr = [] for a in [1,2]: - arr.append(a) + arr.append(a); arr.append # should not cause an exception arr.append() # should not cause an exception @@ -16,7 +16,7 @@ arr[10] arr = [tuple()] for a in [1,2]: - arr.append(a) + arr.append(a); #? int() tuple() arr[10] @@ -112,9 +112,9 @@ iter(lst)[0] # ----------------- # complex including += # ----------------- -class C: pass -class D: pass -class E: pass +class C(): pass +class D(): pass +class E(): pass lst = [1] lst.append(1.0) lst += [C] @@ -207,7 +207,7 @@ blub()[0] # ----------------- # returns, the same for classes # ----------------- -class C: +class C(): def blub(self, b): if 1: a = [] @@ -254,7 +254,7 @@ C().list_arr(1.0)[0] # array recursions # ----------------- -a = {1.0} +a = set([1.0]) a.update(a) a.update([1]) diff --git a/test/completion/dynamic_params.py b/test/completion/dynamic_params.py index b274d235..8af1730c 100644 --- a/test/completion/dynamic_params.py +++ b/test/completion/dynamic_params.py @@ -90,14 +90,14 @@ func.sys # classes # ----------------- -class A: +class A(): def __init__(self, a): #? str() a A("s") -class A: +class A(): def __init__(self, a): #? int() a diff --git a/test/completion/flow_analysis.py b/test/completion/flow_analysis.py index 1b4e742a..af292b47 100644 --- a/test/completion/flow_analysis.py +++ b/test/completion/flow_analysis.py @@ -191,7 +191,7 @@ a # isinstance # ----------------- -class A: pass +class A(): pass def isinst(x): if isinstance(x, A): @@ -251,7 +251,7 @@ if False: # True objects like modules # ----------------- -class X: +class X(): pass if X: a = 1 diff --git a/test/completion/functions.py b/test/completion/functions.py index 3a1c727e..893e4a39 100644 --- a/test/completion/functions.py +++ b/test/completion/functions.py @@ -285,7 +285,7 @@ def memoize(func): return wrapper -class Something: +class Something(): @memoize def x(self, a, b=1): return a diff --git a/test/completion/generators.py b/test/completion/generators.py index e9840128..2327b185 100644 --- a/test/completion/generators.py +++ b/test/completion/generators.py @@ -52,7 +52,7 @@ for a in get(): a -class Get: +class Get(): def __iter__(self): if random.choice([0, 1]): yield 1 diff --git a/test/completion/goto.py b/test/completion/goto.py index a50693d4..adff012d 100644 --- a/test/completion/goto.py +++ b/test/completion/goto.py @@ -83,7 +83,7 @@ c c() -class ClassVar: +class ClassVar(): x = 3 #! ['x = 3'] @@ -103,7 +103,7 @@ def f(t=None): t = t or 1 -class X: +class X(): pass #! 3 [] @@ -158,7 +158,7 @@ from . import some_variable # anonymous classes # ----------------- def func(): - class A: + class A(): def b(self): return 1 return A() @@ -171,7 +171,7 @@ func().b() # ----------------- #! 7 ['class ClassDef'] -class ClassDef: +class ClassDef(): """ abc """ pass @@ -216,7 +216,7 @@ def dec(dec_param=3): def y(): pass -class ClassDec: +class ClassDec(): def class_func(func): return func diff --git a/test/completion/import_tree/classes.py b/test/completion/import_tree/classes.py index ef9a0359..23b088c3 100644 --- a/test/completion/import_tree/classes.py +++ b/test/completion/import_tree/classes.py @@ -1,10 +1,10 @@ blub = 1 -class Config2: +class Config2(): pass -class BaseClass: +class BaseClass(): mode = Config2() if isinstance(whaat, int): mode2 = whaat diff --git a/test/completion/invalid.py b/test/completion/invalid.py index f489e2bb..7c047e66 100644 --- a/test/completion/invalid.py +++ b/test/completion/invalid.py @@ -193,7 +193,7 @@ invalid # classes # ----------------- -class BrokenPartsOfClass: +class BrokenPartsOfClass(): def foo(self): # This construct contains two places where Jedi with Python 3 can fail. # It should just ignore those constructs and still execute `bar`. diff --git a/test/completion/isinstance.py b/test/completion/isinstance.py index 45b18e5b..15fb9a76 100644 --- a/test/completion/isinstance.py +++ b/test/completion/isinstance.py @@ -78,7 +78,7 @@ def isinstance_func(arr): # Names with multiple indices. # ----------------- -class Test: +class Test(): def __init__(self, testing): if isinstance(testing, str): self.testing = testing diff --git a/test/completion/lambdas.py b/test/completion/lambdas.py index c5f10686..524df0ce 100644 --- a/test/completion/lambdas.py +++ b/test/completion/lambdas.py @@ -54,7 +54,7 @@ a = lambda: 3 #? ['__closure__'] a.__closure__ -class C: +class C(): def __init__(self, foo=1.0): self.a = lambda: 1 self.foo = foo diff --git a/test/completion/ordering.py b/test/completion/ordering.py index e2d02d06..61eb1928 100644 --- a/test/completion/ordering.py +++ b/test/completion/ordering.py @@ -20,7 +20,7 @@ b temp a = 1 -temp = b +temp = b; b = a a = temp #? int() @@ -157,7 +157,7 @@ a.real a.a a = 3 -class a: +class a(): def __init__(self, a): self.a = a diff --git a/test/completion/parser.py b/test/completion/parser.py index 37f59446..68793f4f 100644 --- a/test/completion/parser.py +++ b/test/completion/parser.py @@ -2,7 +2,7 @@ Issues with the parser and not the type inference should be part of this file. """ -class IndentIssues: +class IndentIssues(): """ issue jedi-vim#288 Which is really a fast parser issue. It used to start a new block at the diff --git a/test/completion/pep0484_basic.py b/test/completion/pep0484_basic.py index 33fed348..0230d375 100644 --- a/test/completion/pep0484_basic.py +++ b/test/completion/pep0484_basic.py @@ -3,7 +3,7 @@ # python >= 3.2 -class A: +class A(): pass diff --git a/test/completion/recursion.py b/test/completion/recursion.py index a9f013be..a3e7670b 100644 --- a/test/completion/recursion.py +++ b/test/completion/recursion.py @@ -14,7 +14,7 @@ Recursion().a Recursion().b -class X: +class X(): def __init__(self): self.recursive = [1, 3] @@ -39,7 +39,7 @@ def recursion1(foo): recursion1([1,2])[0] -class FooListComp: +class FooListComp(): def __init__(self): self.recursive = [1] diff --git a/test/completion/stdlib.py b/test/completion/stdlib.py index 623e879c..b6b739af 100644 --- a/test/completion/stdlib.py +++ b/test/completion/stdlib.py @@ -61,7 +61,7 @@ import math import os #? type(os) type(math) -class X: pass +class X(): pass #? type type(X) diff --git a/test/completion/usages.py b/test/completion/usages.py index d0509b32..be27ae51 100644 --- a/test/completion/usages.py +++ b/test/completion/usages.py @@ -29,7 +29,7 @@ abc = 5 Abc = 3 #< 6 (0,6), (2,4), (5,8), (17,0) -class Abc: +class Abc(): #< (-2,6), (0,4), (3,8), (15,0) Abc @@ -132,7 +132,7 @@ class TestClassVar(object): #< (0,8), (-7, 8) class_v -class TestInstanceVar: +class TestInstanceVar(): def a(self): #< 13 (4,13), (0,13) self._instance_var = 3 @@ -145,7 +145,7 @@ class TestInstanceVar: self() -class NestedClass: +class NestedClass(): def __getattr__(self, name): return self @@ -249,7 +249,7 @@ if isinstance(j, int): # Dynamic Param Search # ----------------- -class DynamicParam: +class DynamicParam(): def foo(self): return diff --git a/test/static_analysis/attribute_error.py b/test/static_analysis/attribute_error.py index 9747429d..4b084c11 100644 --- a/test/static_analysis/attribute_error.py +++ b/test/static_analysis/attribute_error.py @@ -1,4 +1,4 @@ -class Cls: +class Cls(): class_attr = '' def __init__(self, input): self.instance_attr = 3 @@ -77,7 +77,7 @@ return_one(''.undefined_attribute) [r for r in [1, 2]] # some random error that showed up -class NotCalled: +class NotCalled(): def match_something(self, param): seems_to_need_an_assignment = param return [value.match_something() for value in []] diff --git a/test/static_analysis/attribute_warnings.py b/test/static_analysis/attribute_warnings.py index 5630a5b6..0e1e5e95 100644 --- a/test/static_analysis/attribute_warnings.py +++ b/test/static_analysis/attribute_warnings.py @@ -8,7 +8,7 @@ Jedi issues warnings for possible errors if ``__getattr__``, # ----------------- -class Cls: +class Cls(): def __getattr__(self, name): return getattr(str, name) @@ -32,7 +32,7 @@ Inherited().undefined # ----------------- -class SetattrCls: +class SetattrCls(): def __init__(self, dct): # Jedi doesn't even try to understand such code for k, v in dct.items(): diff --git a/test/static_analysis/class_simple.py b/test/static_analysis/class_simple.py index 63d6073a..3f84fde0 100644 --- a/test/static_analysis/class_simple.py +++ b/test/static_analysis/class_simple.py @@ -1,5 +1,5 @@ class Base(object): - class Nested: + class Nested(): def foo(): pass diff --git a/test/static_analysis/descriptors.py b/test/static_analysis/descriptors.py index a17d1b46..0fc5d159 100644 --- a/test/static_analysis/descriptors.py +++ b/test/static_analysis/descriptors.py @@ -1,5 +1,5 @@ # classmethod -class TarFile: +class TarFile(): @classmethod def open(cls, name, **kwargs): return cls.taropen(name, **kwargs) diff --git a/test/static_analysis/normal_arguments.py b/test/static_analysis/normal_arguments.py index 25729f51..2fc8e81d 100644 --- a/test/static_analysis/normal_arguments.py +++ b/test/static_analysis/normal_arguments.py @@ -60,7 +60,7 @@ default(x=1) # class arguments # ----------------- -class Instance: +class Instance(): def __init__(self, foo): self.foo = foo diff --git a/test/static_analysis/star_arguments.py b/test/static_analysis/star_arguments.py index f1f8c78d..34be43b5 100644 --- a/test/static_analysis/star_arguments.py +++ b/test/static_analysis/star_arguments.py @@ -111,7 +111,7 @@ mixed2(3, b=5) simple(1, **[]) #! 12 type-error-star-star simple(1, **1) -class A: pass +class A(): pass #! 12 type-error-star-star simple(1, **A()) diff --git a/test/static_analysis/try_except.py b/test/static_analysis/try_except.py index 0481de63..e6543280 100644 --- a/test/static_analysis/try_except.py +++ b/test/static_analysis/try_except.py @@ -44,7 +44,7 @@ except (TypeError, NotImplementedError): pass # ----------------- try: str.not_existing -except (AttributeError): pass +except ((AttributeError)): pass try: #! 4 attribute-error str.not_existing