From 2b8ee2f51e148fd5ffb1ff41143c50c1fa8e815d Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Tue, 27 Sep 2016 00:54:23 +0300 Subject: [PATCH] Add a test for print_tokens() --- ChangeLog | 2 ++ tests/test_print_tokens.py | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 tests/test_print_tokens.py diff --git a/ChangeLog b/ChangeLog index d84b637..7a15d54 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ Version 0.0.7 (2016-09-??) Change quoting style to MySQL, PostgreSQL or SQLite. + Add a test for print_tokens(). + Version 0.0.6 (2016-09-25) Condense a sequence of newlines after a /*! directive */; diff --git a/tests/test_print_tokens.py b/tests/test_print_tokens.py new file mode 100644 index 0000000..af9c9ae --- /dev/null +++ b/tests/test_print_tokens.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- + +try: + from cStringIO import StringIO +except ImportError: + try: + from StringIO import StringIO + except ImportError: + from io import StringIO + +from sqlparse import parse +from sqlconvert.print_tokens import print_tokens + + +def test_print_tokens(): + sio = StringIO() + parsed = parse("select * from T")[0] + print_tokens(parsed, outfile=sio) + assert sio.getvalue() == u"SELECT * FROM T" -- 2.39.5