diff options
author | Jesús Leganés Combarro "Piranna" <piranna@gmail.com> | 2012-05-18 22:41:01 +0200 |
---|---|---|
committer | Jesús Leganés Combarro "Piranna" <piranna@gmail.com> | 2012-05-18 22:41:01 +0200 |
commit | a6d6641e5feb0507f08d9167158d4ca033eb940f (patch) | |
tree | b30a64288f9924b2dfb4badb332722e71258cc4f | |
parent | 980a9b70c32da9863af6ca9600cce9a5142ad60f (diff) | |
download | sqlparse-a6d6641e5feb0507f08d9167158d4ca033eb940f.tar.gz |
Added comments and documentation to _get_offset()
-rw-r--r-- | sqlparse/filters.py | 4 | ||||
-rw-r--r-- | tests/test_issue_50.py | 3 |
2 files changed, 6 insertions, 1 deletions
diff --git a/sqlparse/filters.py b/sqlparse/filters.py index 006bccc..a6a34e9 100644 --- a/sqlparse/filters.py +++ b/sqlparse/filters.py @@ -274,6 +274,10 @@ class ReindentFilter: self._last_stmt = None def _get_offset(self, token): + """ + Return the offset where the token should be indented + """ + # Get last processed line (the current one) up to the next token all_ = list(self._curr_stmt.flatten()) idx = all_.index(token) raw = ''.join(unicode(x) for x in all_[:idx + 1]) diff --git a/tests/test_issue_50.py b/tests/test_issue_50.py index 9b603c1..13fd73e 100644 --- a/tests/test_issue_50.py +++ b/tests/test_issue_50.py @@ -11,7 +11,8 @@ from sqlparse import format class Issue_50(TestCase): def test_issue(self): - result = format("SELECT foo, null bar, car FROM dual", reindent = True) + result = format("SELECT foo, null bar, car FROM dual", reindent=True) + print result self.assertEqual(result, """SELECT foo, null bar, |