mirror of https://github.com/mitsuhiko/flask.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.1 KiB
40 lines
1.1 KiB
# Tester for the flaskext_migrate.py module located in flask/scripts/ |
|
# |
|
# Author: Keyan Pishdadian |
|
|
|
import pytest |
|
from redbaron import RedBaron |
|
import flaskext_migrate as migrate |
|
|
|
|
|
def test_simple_from_import(): |
|
red = RedBaron("from flask.ext import foo") |
|
output = migrate.fix(red) |
|
assert output == "import flask_foo as foo" |
|
|
|
|
|
def test_from_to_from_import(): |
|
red = RedBaron("from flask.ext.foo import bar") |
|
output = migrate.fix(red) |
|
assert output == "from flask_foo import bar" |
|
|
|
|
|
def test_multiple_import(): |
|
red = RedBaron("from flask.ext.foo import bar, foobar, something") |
|
output = migrate.fix(red) |
|
assert output == "from flask_foo import bar,foobar,something" |
|
|
|
|
|
def test_multiline_import(): |
|
red = RedBaron("from flask.ext.foo import \ |
|
bar,\ |
|
foobar,\ |
|
something") |
|
output = migrate.fix(red) |
|
assert output == "from flask_foo import bar,foobar,something" |
|
|
|
|
|
def test_module_import(): |
|
red = RedBaron("import flask.ext.foo") |
|
output = migrate.fix(red) |
|
assert output == "import flask_foo"
|
|
|