From c96994dd8d3409b578a0f78cafefc3f8b132d3ae Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Wed, 26 Feb 2020 01:11:04 +0100 Subject: [PATCH] Add a method extract test --- test/refactor/extract_function.py | 34 ++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/test/refactor/extract_function.py b/test/refactor/extract_function.py index e8b0491f..55200507 100644 --- a/test/refactor/extract_function.py +++ b/test/refactor/extract_function.py @@ -298,7 +298,7 @@ def x(v1): #bar return x x -# -------------------------------------------------- in-class-1 +# -------------------------------------------------- in-class-range-1 class X1: #? 11 text {'new_name': 'f', 'until_line': 4} a = 3 @@ -313,3 +313,35 @@ def f(): class X1: #? 11 text {'new_name': 'f', 'until_line': 4} c = f() +# -------------------------------------------------- in-method-range-1 +glob1 = 1 +class X: + # ha + def g(self): pass + + # haha + def f(self, b, c): + #? 11 text {'new_name': 'ab', 'until_line': 12, 'until_column': 28} + #foo + local1 = 3 + local2 = 4 + x= self.g() or self.f(b) ^ glob1 & b is local1 + # bar +# ++++++++++++++++++++++++++++++++++++++++++++++++++ +glob1 = 1 +class X: + # ha + def g(self): pass + + # haha + def ab(self, b): + #foo + local1 = 3 + local2 = 4 + x= self.g() or self.f(b) ^ glob1 & b is local1 + return x + + def f(self, b, c): + #? 11 text {'new_name': 'ab', 'until_line': 12, 'until_column': 28} + x = self.ab(b) + # bar