# Path: supplement/scope.py
# def get_scope_at(project, source, lineno, filename=None, ast_node=None, continous=True):
#     ast_node = ast_node or ast.parse(source)
# 
#     scope = Scope(ast_node, '', None, 'module')
#     scope.project = project
#     scope.filename = filename
#     return scope.get_scope_at(source, lineno, continous)
# 
# Path: tests/helpers.py
# def cleantabs(text):
#     lines = text.splitlines()
#     if not lines[0].strip():
#         lines = lines[1:]
# 
#     toremove = 999
#     for l in lines:
#         stripped = l.lstrip()
#         if stripped:
#             toremove = min(toremove, len(l) - len(stripped))
# 
#     if toremove < 999:
#         return '\n'.join(l[toremove:] for l in lines)
#     else:
#         return '\n'.join(lines)
# 
# def pytest_funcarg__project(request):
#     for crap_module in ('toimport', 'package'):
#         if crap_module in sys.modules:
#             del sys.modules[crap_module]
# 
#     p = Project('.')
#     p.create_module = create_module.__get__(p, Project)
#     p.create_scope = create_scope.__get__(p, Project)
#     p.set_root = set_project_root.__get__(p, Project)
#     return p


from supplement.scope import get_scope_at
from .helpers import cleantabs, pytest_funcarg__project
            @staticmethod
            def m2():
                pass

    """)

    check_scope(project, source, {
        1: 'Cls',
        2: 'Cls',
        3: 'Cls.m1',
        5: 'Cls.m1',
        6: 'Cls.m2',
        7: 'Cls.m2',
        9: 'Cls.m2',
    })

def test_eof_scope(project):
    source = cleantabs("""
        def func(self):
            pass

    """)

    check_scope(project, source, {
        1: 'func',
        2: 'func',
        3: 'func',
    })

def test_non_continous_scope(project):

# Path: supplement/scope.py
# def get_scope_at(project, source, lineno, filename=None, ast_node=None, continous=True):
#     ast_node = ast_node or ast.parse(source)
# 
#     scope = Scope(ast_node, '', None, 'module')
#     scope.project = project
#     scope.filename = filename
#     return scope.get_scope_at(source, lineno, continous)
# 
# Path: tests/helpers.py
# def cleantabs(text):
#     lines = text.splitlines()
#     if not lines[0].strip():
#         lines = lines[1:]
# 
#     toremove = 999
#     for l in lines:
#         stripped = l.lstrip()
#         if stripped:
#             toremove = min(toremove, len(l) - len(stripped))
# 
#     if toremove < 999:
#         return '\n'.join(l[toremove:] for l in lines)
#     else:
#         return '\n'.join(lines)
# 
# def pytest_funcarg__project(request):
#     for crap_module in ('toimport', 'package'):
#         if crap_module in sys.modules:
#             del sys.modules[crap_module]
# 
#     p = Project('.')
#     p.create_module = create_module.__get__(p, Project)
#     p.create_scope = create_scope.__get__(p, Project)
#     p.set_root = set_project_root.__get__(p, Project)
#     return p


# Path: tests/test_scope.py
from supplement.scope import get_scope_at
from .helpers import cleantabs, pytest_funcarg__project

            @staticmethod
            def m2():
                pass

    """)

    check_scope(project, source, {
        1: 'Cls',
        2: 'Cls',
        3: 'Cls.m1',
        5: 'Cls.m1',
        6: 'Cls.m2',
        7: 'Cls.m2',
        9: 'Cls.m2',
    })

def test_eof_scope(project):
    source = cleantabs("""
        def func(self):
            pass

    """)

    check_scope(project, source, {
        1: 'func',
        2: 'func',
        3: 'func',
    })

def test_non_continous_scope(project):

    source = cleantabs("""