1 # -*- coding: utf-8 -*-
4 from io import StringIO, BytesIO
7 from cStringIO import StringIO
9 from StringIO import StringIO
12 from sqlparse import parse
13 from sqlconvert.print_tokens import print_tokens
16 def test_print_tokens():
18 parsed = parse("select * from T")[0]
19 print_tokens(parsed, outfile=sio)
20 assert sio.getvalue() == u"SELECT * FROM T"
23 def test_print_tokens_encoded():
25 parsed = parse("select * from T")[0]
26 print_tokens(parsed, outfile=sio, encoding='ascii')
27 assert sio.getvalue() == b"SELECT * FROM T"