diff options
Diffstat (limited to 'python/testData/refactoring/extractsuperclass')
41 files changed, 213 insertions, 1 deletions
diff --git a/python/testData/refactoring/extractsuperclass/importMultiFile/dest_module.after.py b/python/testData/refactoring/extractsuperclass/importMultiFile/dest_module.after.py new file mode 100644 index 000000000000..eba5f32d8456 --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/importMultiFile/dest_module.after.py @@ -0,0 +1,9 @@ +import shared_module +from shared_module import module_function as my_function, ModuleClass + + +class NewParent(object): + def do_useful_stuff(self): + i = shared_module.MODULE_CONTANT + my_function() + ModuleClass()
\ No newline at end of file diff --git a/python/testData/refactoring/extractsuperclass/importMultiFile/dest_module.py b/python/testData/refactoring/extractsuperclass/importMultiFile/dest_module.py new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/importMultiFile/dest_module.py diff --git a/python/testData/refactoring/extractsuperclass/importMultiFile/shared_module.py b/python/testData/refactoring/extractsuperclass/importMultiFile/shared_module.py new file mode 100644 index 000000000000..13fe833465ef --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/importMultiFile/shared_module.py @@ -0,0 +1,9 @@ +MODULE_CONTANT = 42 + + +def module_function(): + pass + + +class ModuleClass(object): + pass
\ No newline at end of file diff --git a/python/testData/refactoring/extractsuperclass/importMultiFile/source_module.after.py b/python/testData/refactoring/extractsuperclass/importMultiFile/source_module.after.py new file mode 100644 index 000000000000..b9d711783970 --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/importMultiFile/source_module.after.py @@ -0,0 +1,5 @@ +from dest_module import NewParent + + +class MyClass(NewParent): + pass
\ No newline at end of file diff --git a/python/testData/refactoring/extractsuperclass/importMultiFile/source_module.py b/python/testData/refactoring/extractsuperclass/importMultiFile/source_module.py new file mode 100644 index 000000000000..aa10bca28fea --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/importMultiFile/source_module.py @@ -0,0 +1,9 @@ +import shared_module +from shared_module import module_function as my_function +from shared_module import ModuleClass + +class MyClass(object): + def do_useful_stuff(self): + i = shared_module.MODULE_CONTANT + my_function() + ModuleClass()
\ No newline at end of file diff --git a/python/testData/refactoring/extractsuperclass/importNotBroken.after.py b/python/testData/refactoring/extractsuperclass/importNotBroken.after.py new file mode 100644 index 000000000000..897c62a71cfc --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/importNotBroken.after.py @@ -0,0 +1,9 @@ +from shared import SharedClass + + +class DestClass(SharedClass): + pass + + +class Source(DestClass): + pass
\ No newline at end of file diff --git a/python/testData/refactoring/extractsuperclass/importNotBroken.before.py b/python/testData/refactoring/extractsuperclass/importNotBroken.before.py new file mode 100644 index 000000000000..82d6d5c04c20 --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/importNotBroken.before.py @@ -0,0 +1,5 @@ +from shared import SharedClass + + +class Source(SharedClass): + pass
\ No newline at end of file diff --git a/python/testData/refactoring/extractsuperclass/importNotBrokenManyFiles/dest_module.after.py b/python/testData/refactoring/extractsuperclass/importNotBrokenManyFiles/dest_module.after.py new file mode 100644 index 000000000000..6189ad4fc76b --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/importNotBrokenManyFiles/dest_module.after.py @@ -0,0 +1,5 @@ +from shared_module import SharedClass + + +class NewParent(SharedClass): + pass
\ No newline at end of file diff --git a/python/testData/refactoring/extractsuperclass/importNotBrokenManyFiles/dest_module.py b/python/testData/refactoring/extractsuperclass/importNotBrokenManyFiles/dest_module.py new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/importNotBrokenManyFiles/dest_module.py diff --git a/python/testData/refactoring/extractsuperclass/importNotBrokenManyFiles/shared_module.py b/python/testData/refactoring/extractsuperclass/importNotBrokenManyFiles/shared_module.py new file mode 100644 index 000000000000..da81c49673f4 --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/importNotBrokenManyFiles/shared_module.py @@ -0,0 +1 @@ +class SharedClass(object): pass
\ No newline at end of file diff --git a/python/testData/refactoring/extractsuperclass/importNotBrokenManyFiles/source_module.after.py b/python/testData/refactoring/extractsuperclass/importNotBrokenManyFiles/source_module.after.py new file mode 100644 index 000000000000..b9d711783970 --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/importNotBrokenManyFiles/source_module.after.py @@ -0,0 +1,5 @@ +from dest_module import NewParent + + +class MyClass(NewParent): + pass
\ No newline at end of file diff --git a/python/testData/refactoring/extractsuperclass/importNotBrokenManyFiles/source_module.py b/python/testData/refactoring/extractsuperclass/importNotBrokenManyFiles/source_module.py new file mode 100644 index 000000000000..1824aec09d61 --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/importNotBrokenManyFiles/source_module.py @@ -0,0 +1,4 @@ +from shared_module import SharedClass + +class MyClass(SharedClass): + pass
\ No newline at end of file diff --git a/python/testData/refactoring/extractsuperclass/instanceNotDeclaredInInit.after.py b/python/testData/refactoring/extractsuperclass/instanceNotDeclaredInInit.after.py new file mode 100644 index 000000000000..ef3511dc8c66 --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/instanceNotDeclaredInInit.after.py @@ -0,0 +1,8 @@ +class Parent(object): + def __init__(self): + self.eggs = 12 + + +class Child(Parent): + def foo(self): + self.eggs = 12 diff --git a/python/testData/refactoring/extractsuperclass/instanceNotDeclaredInInit.before.py b/python/testData/refactoring/extractsuperclass/instanceNotDeclaredInInit.before.py new file mode 100644 index 000000000000..9c5594a80067 --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/instanceNotDeclaredInInit.before.py @@ -0,0 +1,3 @@ +class Child(object): + def foo(self): + self.eggs = 12 diff --git a/python/testData/refactoring/extractsuperclass/moveAndMakeAbstract/abc.py b/python/testData/refactoring/extractsuperclass/moveAndMakeAbstract/abc.py new file mode 100644 index 000000000000..ef4f2f69e838 --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/moveAndMakeAbstract/abc.py @@ -0,0 +1,8 @@ +# Stubs + +class ABCMeta: + pass + + +def abstractmethod(foo): + pass
\ No newline at end of file diff --git a/python/testData/refactoring/extractsuperclass/moveAndMakeAbstract/dest_module.after.py b/python/testData/refactoring/extractsuperclass/moveAndMakeAbstract/dest_module.after.py new file mode 100644 index 000000000000..bbf726c919ae --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/moveAndMakeAbstract/dest_module.after.py @@ -0,0 +1,13 @@ +from abc import abstractmethod +from abc import ABCMeta + + +class NewParent(object): + __metaclass__ = ABCMeta + + @abstractmethod + def foo_method(self): + """ + Foo + """ + pass
\ No newline at end of file diff --git a/python/testData/refactoring/extractsuperclass/moveAndMakeAbstract/dest_module.py b/python/testData/refactoring/extractsuperclass/moveAndMakeAbstract/dest_module.py new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/moveAndMakeAbstract/dest_module.py diff --git a/python/testData/refactoring/extractsuperclass/moveAndMakeAbstract/shared_module.py b/python/testData/refactoring/extractsuperclass/moveAndMakeAbstract/shared_module.py new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/moveAndMakeAbstract/shared_module.py diff --git a/python/testData/refactoring/extractsuperclass/moveAndMakeAbstract/source_module.after.py b/python/testData/refactoring/extractsuperclass/moveAndMakeAbstract/source_module.after.py new file mode 100644 index 000000000000..6e71752a511d --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/moveAndMakeAbstract/source_module.after.py @@ -0,0 +1,9 @@ +from dest_module import NewParent + + +class MyClass(NewParent): + def foo_method(self): + """ + Foo + """ + spam = "eggs"
\ No newline at end of file diff --git a/python/testData/refactoring/extractsuperclass/moveAndMakeAbstract/source_module.py b/python/testData/refactoring/extractsuperclass/moveAndMakeAbstract/source_module.py new file mode 100644 index 000000000000..f4a7c42a7df4 --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/moveAndMakeAbstract/source_module.py @@ -0,0 +1,6 @@ +class MyClass(object): + def foo_method(self): + """ + Foo + """ + spam = "eggs"
\ No newline at end of file diff --git a/python/testData/refactoring/extractsuperclass/moveAndMakeAbstractImportExistsPy3/abc.py b/python/testData/refactoring/extractsuperclass/moveAndMakeAbstractImportExistsPy3/abc.py new file mode 100644 index 000000000000..ef4f2f69e838 --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/moveAndMakeAbstractImportExistsPy3/abc.py @@ -0,0 +1,8 @@ +# Stubs + +class ABCMeta: + pass + + +def abstractmethod(foo): + pass
\ No newline at end of file diff --git a/python/testData/refactoring/extractsuperclass/moveAndMakeAbstractImportExistsPy3/dest_module.after.py b/python/testData/refactoring/extractsuperclass/moveAndMakeAbstractImportExistsPy3/dest_module.after.py new file mode 100644 index 000000000000..ddce4a86100f --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/moveAndMakeAbstractImportExistsPy3/dest_module.after.py @@ -0,0 +1,13 @@ +from abc import ABCMeta +from abc import abstractmethod + + +ABCMeta() +abstractmethod() + + +class NewParent(metaclass=ABCMeta): + @classmethod + @abstractmethod + def foo_method(cls): + pass
\ No newline at end of file diff --git a/python/testData/refactoring/extractsuperclass/moveAndMakeAbstractImportExistsPy3/dest_module.py b/python/testData/refactoring/extractsuperclass/moveAndMakeAbstractImportExistsPy3/dest_module.py new file mode 100644 index 000000000000..81549d3c4c0f --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/moveAndMakeAbstractImportExistsPy3/dest_module.py @@ -0,0 +1,6 @@ +from abc import ABCMeta +from abc import abstractmethod + + +ABCMeta() +abstractmethod()
\ No newline at end of file diff --git a/python/testData/refactoring/extractsuperclass/moveAndMakeAbstractImportExistsPy3/shared_module.py b/python/testData/refactoring/extractsuperclass/moveAndMakeAbstractImportExistsPy3/shared_module.py new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/moveAndMakeAbstractImportExistsPy3/shared_module.py diff --git a/python/testData/refactoring/extractsuperclass/moveAndMakeAbstractImportExistsPy3/source_module.after.py b/python/testData/refactoring/extractsuperclass/moveAndMakeAbstractImportExistsPy3/source_module.after.py new file mode 100644 index 000000000000..02c129fc8082 --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/moveAndMakeAbstractImportExistsPy3/source_module.after.py @@ -0,0 +1,7 @@ +from dest_module import NewParent + + +class MyClass(NewParent): + @classmethod + def foo_method(cls): + spam = "eggs"
\ No newline at end of file diff --git a/python/testData/refactoring/extractsuperclass/moveAndMakeAbstractImportExistsPy3/source_module.py b/python/testData/refactoring/extractsuperclass/moveAndMakeAbstractImportExistsPy3/source_module.py new file mode 100644 index 000000000000..b197c5fc2bfa --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/moveAndMakeAbstractImportExistsPy3/source_module.py @@ -0,0 +1,4 @@ +class MyClass(): + @classmethod + def foo_method(cls): + spam = "eggs"
\ No newline at end of file diff --git a/python/testData/refactoring/extractsuperclass/moveExtends/dest_module.after.py b/python/testData/refactoring/extractsuperclass/moveExtends/dest_module.after.py new file mode 100644 index 000000000000..1171abf73b10 --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/moveExtends/dest_module.after.py @@ -0,0 +1,5 @@ +from shared_module import TheParentOfItAll + + +class NewParent(TheParentOfItAll): + pass
\ No newline at end of file diff --git a/python/testData/refactoring/extractsuperclass/moveExtends/dest_module.py b/python/testData/refactoring/extractsuperclass/moveExtends/dest_module.py new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/moveExtends/dest_module.py diff --git a/python/testData/refactoring/extractsuperclass/moveExtends/shared_module.py b/python/testData/refactoring/extractsuperclass/moveExtends/shared_module.py new file mode 100644 index 000000000000..fd3d3fc7bf88 --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/moveExtends/shared_module.py @@ -0,0 +1,2 @@ +class TheParentOfItAll(object): + pass
\ No newline at end of file diff --git a/python/testData/refactoring/extractsuperclass/moveExtends/source_module.after.py b/python/testData/refactoring/extractsuperclass/moveExtends/source_module.after.py new file mode 100644 index 000000000000..b9d711783970 --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/moveExtends/source_module.after.py @@ -0,0 +1,5 @@ +from dest_module import NewParent + + +class MyClass(NewParent): + pass
\ No newline at end of file diff --git a/python/testData/refactoring/extractsuperclass/moveExtends/source_module.py b/python/testData/refactoring/extractsuperclass/moveExtends/source_module.py new file mode 100644 index 000000000000..87c753aa0698 --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/moveExtends/source_module.py @@ -0,0 +1,4 @@ +import shared_module + +class MyClass(shared_module.TheParentOfItAll): + pass
\ No newline at end of file diff --git a/python/testData/refactoring/extractsuperclass/moveExtendsCheckReference/dest_module.after.py b/python/testData/refactoring/extractsuperclass/moveExtendsCheckReference/dest_module.after.py new file mode 100644 index 000000000000..1171abf73b10 --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/moveExtendsCheckReference/dest_module.after.py @@ -0,0 +1,5 @@ +from shared_module import TheParentOfItAll + + +class NewParent(TheParentOfItAll): + pass
\ No newline at end of file diff --git a/python/testData/refactoring/extractsuperclass/moveExtendsCheckReference/dest_module.py b/python/testData/refactoring/extractsuperclass/moveExtendsCheckReference/dest_module.py new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/moveExtendsCheckReference/dest_module.py diff --git a/python/testData/refactoring/extractsuperclass/moveExtendsCheckReference/shared_module.py b/python/testData/refactoring/extractsuperclass/moveExtendsCheckReference/shared_module.py new file mode 100644 index 000000000000..fd3d3fc7bf88 --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/moveExtendsCheckReference/shared_module.py @@ -0,0 +1,2 @@ +class TheParentOfItAll(object): + pass
\ No newline at end of file diff --git a/python/testData/refactoring/extractsuperclass/moveExtendsCheckReference/source_module.after.py b/python/testData/refactoring/extractsuperclass/moveExtendsCheckReference/source_module.after.py new file mode 100644 index 000000000000..b9d711783970 --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/moveExtendsCheckReference/source_module.after.py @@ -0,0 +1,5 @@ +from dest_module import NewParent + + +class MyClass(NewParent): + pass
\ No newline at end of file diff --git a/python/testData/refactoring/extractsuperclass/moveExtendsCheckReference/source_module.py b/python/testData/refactoring/extractsuperclass/moveExtendsCheckReference/source_module.py new file mode 100644 index 000000000000..c2ca97497a33 --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/moveExtendsCheckReference/source_module.py @@ -0,0 +1,4 @@ +from shared_module import TheParentOfItAll + +class MyClass(TheParentOfItAll): + pass
\ No newline at end of file diff --git a/python/testData/refactoring/extractsuperclass/moveFields.after.py b/python/testData/refactoring/extractsuperclass/moveFields.after.py new file mode 100644 index 000000000000..043e4d34a5ff --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/moveFields.after.py @@ -0,0 +1,10 @@ +class ToClass(object): + CLASS_FIELD = 42 + + def __init__(self): + self.instance_field = 100500 + + +class FromClass(ToClass): + def __init__(self): + pass
\ No newline at end of file diff --git a/python/testData/refactoring/extractsuperclass/moveFields.before.py b/python/testData/refactoring/extractsuperclass/moveFields.before.py new file mode 100644 index 000000000000..54a167fac430 --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/moveFields.before.py @@ -0,0 +1,4 @@ +class FromClass(object): + CLASS_FIELD = 42 + def __init__(self): + self.instance_field = 100500 diff --git a/python/testData/refactoring/extractsuperclass/presenter/file.py b/python/testData/refactoring/extractsuperclass/presenter/file.py new file mode 100644 index 000000000000..9e6af14bf862 --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/presenter/file.py @@ -0,0 +1,20 @@ +from datetime import date +class Child(object, date): + CLASS_VAR = "spam" + + def eggs(self): # May be abstract + pass + + def __init__(self): + super(Child, self).__init__() + self.artur = "king" + +class StaticOnly(object): + @staticmethod + def static_method(): # May be abstract in case of Py3 + pass + + +class OldClass(): + def foo(self): + pass
\ No newline at end of file diff --git a/python/testData/refactoring/extractsuperclass/shared.py b/python/testData/refactoring/extractsuperclass/shared.py new file mode 100644 index 000000000000..71f03ab781fc --- /dev/null +++ b/python/testData/refactoring/extractsuperclass/shared.py @@ -0,0 +1 @@ +class SharedClass: pass
\ No newline at end of file diff --git a/python/testData/refactoring/extractsuperclass/withImport.after.py b/python/testData/refactoring/extractsuperclass/withImport.after.py index ccd508bbebd7..86018635c236 100644 --- a/python/testData/refactoring/extractsuperclass/withImport.after.py +++ b/python/testData/refactoring/extractsuperclass/withImport.after.py @@ -1,4 +1,3 @@ -import os from refactoring.extractsuperclass import Suppa |