summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlaixintao <laixintaoo@gmail.com>2020-03-09 16:23:53 +0800
committerlaixintao <laixintaoo@gmail.com>2020-03-09 16:23:53 +0800
commit4b6d0496ccc18d0ebd696b5f21d8065c4a9b0cb9 (patch)
tree2ff32a00b78dfbcfedb965cdd88b16509c2ed7d6
parentdb20c933b458048e0b925c2494341c17b5e3dd4f (diff)
black format, remove 2.7 support.
-rw-r--r--pgcli/main.py2
-rw-r--r--pgcli/pgexecute.py4
-rw-r--r--tests/test_pgexecute.py36
3 files changed, 21 insertions, 21 deletions
diff --git a/pgcli/main.py b/pgcli/main.py
index 54d4941f..fb3b3546 100644
--- a/pgcli/main.py
+++ b/pgcli/main.py
@@ -363,7 +363,7 @@ class PGCli(object):
user=user,
host=host,
port=port,
- **self.pgexecute.extra_args
+ **self.pgexecute.extra_args,
)
except OperationalError as e:
click.secho(str(e), err=True, fg="red")
diff --git a/pgcli/pgexecute.py b/pgcli/pgexecute.py
index 20ef5518..a33afe6f 100644
--- a/pgcli/pgexecute.py
+++ b/pgcli/pgexecute.py
@@ -201,7 +201,7 @@ class PGExecute(object):
host=None,
port=None,
dsn=None,
- **kwargs
+ **kwargs,
):
self._conn_params = {}
self.conn = None
@@ -227,7 +227,7 @@ class PGExecute(object):
host=None,
port=None,
dsn=None,
- **kwargs
+ **kwargs,
):
conn_params = self._conn_params.copy()
diff --git a/tests/test_pgexecute.py b/tests/test_pgexecute.py
index 32e3bfbf..46bd735c 100644
--- a/tests/test_pgexecute.py
+++ b/tests/test_pgexecute.py
@@ -240,10 +240,10 @@ def expanded(request):
@dbtest
def test_unicode_support_in_output(executor, expanded):
run(executor, "create table unicodechars(t text)")
- run(executor, u"insert into unicodechars (t) values ('é')")
+ run(executor, "insert into unicodechars (t) values ('é')")
# See issue #24, this raises an exception without proper handling
- assert u"é" in run(
+ assert "é" in run(
executor, "select * from unicodechars", join=True, expanded=expanded
)
@@ -304,10 +304,10 @@ def test_multiple_queries_with_special_command_same_line(executor, pgspecial):
def test_multiple_queries_same_line_syntaxerror(executor, exception_formatter):
result = run(
executor,
- u"select 'fooé'; invalid syntax é",
+ "select 'fooé'; invalid syntax é",
exception_formatter=exception_formatter,
)
- assert u"fooé" in result[3]
+ assert "fooé" in result[3]
assert 'syntax error at or near "invalid"' in result[-1]
@@ -319,8 +319,8 @@ def pgspecial():
@dbtest
def test_special_command_help(executor, pgspecial):
result = run(executor, "\\?", pgspecial=pgspecial)[1].split("|")
- assert u"Command" in result[1]
- assert u"Description" in result[2]
+ assert "Command" in result[1]
+ assert "Description" in result[2]
@dbtest
@@ -328,42 +328,42 @@ def test_bytea_field_support_in_output(executor):
run(executor, "create table binarydata(c bytea)")
run(executor, "insert into binarydata (c) values (decode('DEADBEEF', 'hex'))")
- assert u"\\xdeadbeef" in run(executor, "select * from binarydata", join=True)
+ assert "\\xdeadbeef" in run(executor, "select * from binarydata", join=True)
@dbtest
def test_unicode_support_in_unknown_type(executor):
- assert u"日本語" in run(executor, u"SELECT '日本語' AS japanese;", join=True)
+ assert "日本語" in run(executor, "SELECT '日本語' AS japanese;", join=True)
@dbtest
def test_unicode_support_in_enum_type(executor):
- run(executor, u"CREATE TYPE mood AS ENUM ('sad', 'ok', 'happy', '日本語')")
- run(executor, u"CREATE TABLE person (name TEXT, current_mood mood)")
- run(executor, u"INSERT INTO person VALUES ('Moe', '日本語')")
- assert u"日本語" in run(executor, u"SELECT * FROM person", join=True)
+ run(executor, "CREATE TYPE mood AS ENUM ('sad', 'ok', 'happy', '日本語')")
+ run(executor, "CREATE TABLE person (name TEXT, current_mood mood)")
+ run(executor, "INSERT INTO person VALUES ('Moe', '日本語')")
+ assert "日本語" in run(executor, "SELECT * FROM person", join=True)
@requires_json
def test_json_renders_without_u_prefix(executor, expanded):
- run(executor, u"create table jsontest(d json)")
- run(executor, u"""insert into jsontest (d) values ('{"name": "Éowyn"}')""")
+ run(executor, "create table jsontest(d json)")
+ run(executor, """insert into jsontest (d) values ('{"name": "Éowyn"}')""")
result = run(
- executor, u"SELECT d FROM jsontest LIMIT 1", join=True, expanded=expanded
+ executor, "SELECT d FROM jsontest LIMIT 1", join=True, expanded=expanded
)
- assert u'{"name": "Éowyn"}' in result
+ assert '{"name": "Éowyn"}' in result
@requires_jsonb
def test_jsonb_renders_without_u_prefix(executor, expanded):
run(executor, "create table jsonbtest(d jsonb)")
- run(executor, u"""insert into jsonbtest (d) values ('{"name": "Éowyn"}')""")
+ run(executor, """insert into jsonbtest (d) values ('{"name": "Éowyn"}')""")
result = run(
executor, "SELECT d FROM jsonbtest LIMIT 1", join=True, expanded=expanded
)
- assert u'{"name": "Éowyn"}' in result
+ assert '{"name": "Éowyn"}' in result
@dbtest