diff options
Diffstat (limited to 'pylint/test/utils/unittest_utils.py')
| -rw-r--r-- | pylint/test/utils/unittest_utils.py | 195 | 
1 files changed, 0 insertions, 195 deletions
diff --git a/pylint/test/utils/unittest_utils.py b/pylint/test/utils/unittest_utils.py index c80cf2c9d..a009391de 100644 --- a/pylint/test/utils/unittest_utils.py +++ b/pylint/test/utils/unittest_utils.py @@ -19,9 +19,6 @@  import io  import re -import astroid - -from pylint.checkers.utils import get_node_last_lineno  from pylint.utils import utils @@ -52,195 +49,3 @@ def test_decoding_stream_known_encoding():      binary_io = io.BytesIO("€".encode("cp1252"))      stream = utils.decoding_stream(binary_io, "cp1252")      assert stream.read() == "€" - - -class TestGetNodeLastLineno: -    def test_get_node_last_lineno_simple(self): -        node = astroid.extract_node( -            """ -            pass -        """ -        ) -        assert get_node_last_lineno(node) == 2 - -    def test_get_node_last_lineno_if_simple(self): -        node = astroid.extract_node( -            """ -            if True: -                print(1) -                pass -            """ -        ) -        assert get_node_last_lineno(node) == 4 - -    def test_get_node_last_lineno_if_elseif_else(self): -        node = astroid.extract_node( -            """ -            if True: -                print(1) -            elif False: -                print(2) -            else: -                print(3) -            """ -        ) -        assert get_node_last_lineno(node) == 7 - -    def test_get_node_last_lineno_while(self): -        node = astroid.extract_node( -            """ -            while True: -                print(1) -            """ -        ) -        assert get_node_last_lineno(node) == 3 - -    def test_get_node_last_lineno_while_else(self): -        node = astroid.extract_node( -            """ -            while True: -                print(1) -            else: -                print(2) -            """ -        ) -        assert get_node_last_lineno(node) == 5 - -    def test_get_node_last_lineno_for(self): -        node = astroid.extract_node( -            """ -            for x in range(0, 5): -                print(1) -            """ -        ) -        assert get_node_last_lineno(node) == 3 - -    def test_get_node_last_lineno_for_else(self): -        node = astroid.extract_node( -            """ -            for x in range(0, 5): -                print(1) -            else: -                print(2) -            """ -        ) -        assert get_node_last_lineno(node) == 5 - -    def test_get_node_last_lineno_try(self): -        node = astroid.extract_node( -            """ -            try: -                print(1) -            except ValueError: -                print(2) -            except Exception: -                print(3) -            """ -        ) -        assert get_node_last_lineno(node) == 7 - -    def test_get_node_last_lineno_try_except_else(self): -        node = astroid.extract_node( -            """ -            try: -                print(1) -            except Exception: -                print(2) -                print(3) -            else: -                print(4) -            """ -        ) -        assert get_node_last_lineno(node) == 8 - -    def test_get_node_last_lineno_try_except_finally(self): -        node = astroid.extract_node( -            """ -            try: -                print(1) -            except Exception: -                print(2) -            finally: -                print(4) -            """ -        ) -        assert get_node_last_lineno(node) == 7 - -    def test_get_node_last_lineno_try_except_else_finally(self): -        node = astroid.extract_node( -            """ -            try: -                print(1) -            except Exception: -                print(2) -            else: -                print(3) -            finally: -                print(4) -            """ -        ) -        assert get_node_last_lineno(node) == 9 - -    def test_get_node_last_lineno_with(self): -        node = astroid.extract_node( -            """ -            with x as y: -                print(1) -                pass -            """ -        ) -        assert get_node_last_lineno(node) == 4 - -    def test_get_node_last_lineno_method(self): -        node = astroid.extract_node( -            """ -            def x(a, b): -                print(a, b) -                pass -            """ -        ) -        assert get_node_last_lineno(node) == 4 - -    def test_get_node_last_lineno_decorator(self): -        node = astroid.extract_node( -            """ -            @decor() -            def x(a, b): -                print(a, b) -                pass -            """ -        ) -        assert get_node_last_lineno(node) == 5 - -    def test_get_node_last_lineno_class(self): -        node = astroid.extract_node( -            """ -            class C(object): -                CONST = True - -                def x(self, b): -                    print(b) - -                def y(self): -                    pass -                    pass -            """ -        ) -        assert get_node_last_lineno(node) == 10 - -    def test_get_node_last_lineno_combined(self): -        node = astroid.extract_node( -            """ -            class C(object): -                CONST = True - -                def y(self): -                    try: -                        pass -                    except: -                        pass -                    finally: -                        pass -            """ -        ) -        assert get_node_last_lineno(node) == 11  | 
