-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The previous function would ignore changes in numbers and quoted whitespace. We can use sqlparse to normalize the given SQL for easy comparison.
- Loading branch information
Showing
2 changed files
with
30 additions
and
17 deletions.
There are no files selected for viewing
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
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,16 @@ | ||
from django_db_views.autodetector import ViewMigrationAutoDetector | ||
|
||
|
||
def test_is_same_views(): | ||
is_same = ViewMigrationAutoDetector.is_same_views | ||
|
||
assert is_same("A B C", "A B C") | ||
assert is_same("select * from xyz", "SELECT * FROM xyz") | ||
assert not is_same("select 1 from test", "select 2 from test") | ||
assert is_same("select *\nfrom test\n", "select * from test") | ||
assert is_same( | ||
"SELECT\n\t * \n FROM something where a = ' ' and B = \" \"", | ||
"select * from something where a = ' ' and b = \" \"", | ||
) | ||
assert not is_same('SELECT " "', 'SELECT ""') | ||
assert not is_same('SELECT "TEST "', 'SELECT "TEST "') |