forked from dflook/python-minifier
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_import.py
More file actions
32 lines (28 loc) · 742 Bytes
/
test_import.py
File metadata and controls
32 lines (28 loc) · 742 Bytes
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
import ast
import pytest
from python_minifier import unparse
@pytest.mark.parametrize(
'statement', [
'import a',
'import a,b',
'import a as b',
'import a as b,c as d',
'import a.b',
'import a.b.c',
'import a.b.c as d',
'import a.b.c as d,e as f',
'from a import A',
'from.import A',
'from.import*',
'from..import A,B',
'from.a import A',
'from...a import A',
'from...a import*',
'from a import A as B',
'from a import A as B,C as D',
'from.a.b import A',
'from....a.b.c import A',
]
)
def test_import_statement(statement):
assert unparse(ast.parse(statement)) == statement