diff options
author | Andi Albrecht <albrecht.andi@gmail.com> | 2020-09-13 08:22:57 +0200 |
---|---|---|
committer | Andi Albrecht <albrecht.andi@gmail.com> | 2020-09-13 08:22:57 +0200 |
commit | fd2c8e3d42a74f43c1f473628ec033431b27a534 (patch) | |
tree | 80bed5e5d91de2cd9854b326d34ddcd3dfce4aed /tests/test_cli.py | |
parent | 44965c2d155c312662ede94cab4b355d4eab6a5c (diff) | |
parent | 6a02ed19fa7f5c8dc08f54ff89fbbc4ba8b5bebd (diff) | |
download | sqlparse-fd2c8e3d42a74f43c1f473628ec033431b27a534.tar.gz |
Merge branch 'jdufresne-py2'
Diffstat (limited to 'tests/test_cli.py')
-rw-r--r-- | tests/test_cli.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/tests/test_cli.py b/tests/test_cli.py index 5f1ea0e..746b632 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - import subprocess import sys @@ -71,7 +69,7 @@ def test_stdout(filepath, load_file, capsys): def test_script(): # Call with the --help option as a basic sanity check. - cmd = "{0:s} -m sqlparse.cli --help".format(sys.executable) + cmd = "{:s} -m sqlparse.cli --help".format(sys.executable) assert subprocess.call(cmd.split()) == 0 @@ -115,7 +113,7 @@ def test_encoding_stdin_utf8(filepath, load_file, capfd): path = filepath('encoding_utf8.sql') expected = load_file('encoding_utf8.sql', 'utf-8') old_stdin = sys.stdin - with open(path, 'r') as f: + with open(path) as f: sys.stdin = f sys.stdout.encoding = 'utf-8' sqlparse.cli.main(['-']) @@ -128,7 +126,7 @@ def test_encoding_stdin_gbk(filepath, load_file, capfd): path = filepath('encoding_gbk.sql') expected = load_file('encoding_gbk.sql', 'gbk') old_stdin = sys.stdin - with open(path, 'r') as stream: + with open(path) as stream: sys.stdin = stream sys.stdout.encoding = 'gbk' sqlparse.cli.main(['-', '--encoding', 'gbk']) @@ -139,7 +137,7 @@ def test_encoding_stdin_gbk(filepath, load_file, capfd): def test_encoding(filepath, capsys): path = filepath('test_cp1251.sql') - expected = u'insert into foo values (1); -- Песня про надежду\n' + expected = 'insert into foo values (1); -- Песня про надежду\n' sqlparse.cli.main([path, '--encoding=cp1251']) out, _ = capsys.readouterr() assert out == expected |