Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests, remove manual testing file #1135
- Loading branch information
Showing
2 changed files
with
40 additions
and
34 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# 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" |