summaryrefslogtreecommitdiff
path: root/tests/functional/i/import_outside_toplevel.py
blob: 3ed7701cca861683f69979914082d7b91dcb733d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# pylint: disable=unused-import,multiple-imports,no-self-use,missing-docstring,invalid-name,too-few-public-methods

import abc

if 4 == 5:
    import ast


def f():
    import symtable  # [import-outside-toplevel]


def g():
    import os, sys  # [import-outside-toplevel]


def h():
    import time as thyme  # [import-outside-toplevel]


def i():
    import random as rand, socket as sock  # [import-outside-toplevel]


class C:
    import tokenize  # [import-outside-toplevel]

    def j(self):
        import turtle  # [import-outside-toplevel]


def k(flag):
    if flag:
        import tabnanny  # [import-outside-toplevel]


def j():
    from collections import defaultdict # [import-outside-toplevel]


def m():
    from math import sin as sign, cos as cosplay  # [import-outside-toplevel]


# Test allow-any-import-level setting
def n():
    import astroid

def o():
    import notastroid  # [import-error, import-outside-toplevel]