diff options
| author | Andi Albrecht <albrecht.andi@gmail.com> | 2016-07-22 21:46:42 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-07-22 21:46:42 +0200 |
| commit | d9c83c2e2ba1a2de837fb5221c4996b3c278232e (patch) | |
| tree | 6ea82afaced48bc05ff767afe61c1f20a8e84694 | |
| parent | 0f01c93f9463e174258147e22e3bdfe22b66f142 (diff) | |
| parent | 1cb94246640ac5583f73511d7a47240340a1e583 (diff) | |
| download | sqlparse-d9c83c2e2ba1a2de837fb5221c4996b3c278232e.tar.gz | |
Merge pull request #274 from gmccreight/master
Failing test: stream worked in 0.1.19
| -rw-r--r-- | tests/conftest.py | 8 | ||||
| -rw-r--r-- | tests/files/stream.sql | 2 | ||||
| -rw-r--r-- | tests/test_regressions.py | 6 |
3 files changed, 16 insertions, 0 deletions
diff --git a/tests/conftest.py b/tests/conftest.py index d5621eb..38fe5c6 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -39,3 +39,11 @@ def load_file(filepath): return f.read() return make_load_file + + +@pytest.fixture() +def get_stream(filepath): + def make_stream(filename, encoding='utf-8'): + return io.open(filepath(filename), encoding=encoding) + + return make_stream diff --git a/tests/files/stream.sql b/tests/files/stream.sql new file mode 100644 index 0000000..c1b73b0 --- /dev/null +++ b/tests/files/stream.sql @@ -0,0 +1,2 @@ +-- this file is streamed in +insert into foo diff --git a/tests/test_regressions.py b/tests/test_regressions.py index 255493c..5d04131 100644 --- a/tests/test_regressions.py +++ b/tests/test_regressions.py @@ -184,6 +184,12 @@ def test_format_accepts_encoding(load_file): assert formatted == tformatted +def test_stream(get_stream): + stream = get_stream("stream.sql") + p = sqlparse.parse(stream)[0] + assert p.get_type() == 'INSERT' + + def test_issue90(): sql = ('UPDATE "gallery_photo" SET "owner_id" = 4018, "deleted_at" = NULL,' ' "width" = NULL, "height" = NULL, "rating_votes" = 0,' |
