summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorERYoung11 <78834571+ERYoung11@users.noreply.github.com>2022-08-31 21:48:06 -0500
committerERYoung11 <78834571+ERYoung11@users.noreply.github.com>2022-08-31 21:48:06 -0500
commit2850c8331050e502039cd9ca71407026fe2f409f (patch)
treec65fc1374b366dbb60d4b189237e300da864671a
parentf5669e756b0d741d3287647bc1f62606762bd55b (diff)
black'd the code.
-rw-r--r--pgcli/pgexecute.py14
-rw-r--r--tests/test_pgexecute.py10
2 files changed, 14 insertions, 10 deletions
diff --git a/pgcli/pgexecute.py b/pgcli/pgexecute.py
index 85a52c0d..8f2968d6 100644
--- a/pgcli/pgexecute.py
+++ b/pgcli/pgexecute.py
@@ -308,22 +308,22 @@ class PGExecute:
# sql parse doesn't split on a comment first + special
# so we're going to do it
-
- sqltemp=[]
- sqlarr=[]
+
+ sqltemp = []
+ sqlarr = []
if statement.startswith("--"):
- sqltemp=statement.split("\n")
+ sqltemp = statement.split("\n")
sqlarr.append(sqltemp[0])
for i in sqlparse.split(sqltemp[1]):
sqlarr.append(i)
elif statement.startswith("/*"):
- sqltemp=statement.split("*/")
- sqltemp[0]=sqltemp[0]+"*/"
+ sqltemp = statement.split("*/")
+ sqltemp[0] = sqltemp[0] + "*/"
for i in sqlparse.split(sqltemp[1]):
sqlarr.append(i)
else:
- sqlarr = sqlparse.split(statement)
+ sqlarr = sqlparse.split(statement)
# run each sql query
for sql in sqlarr:
diff --git a/tests/test_pgexecute.py b/tests/test_pgexecute.py
index 67959633..51f9034c 100644
--- a/tests/test_pgexecute.py
+++ b/tests/test_pgexecute.py
@@ -281,8 +281,11 @@ def test_execute_from_file_io_error(os, executor, pgspecial):
assert success == False
assert is_special == True
+
@dbtest
-def test_execute_from_commented_file_that_executes_another_file(executor, pgspecial, tmpdir):
+def test_execute_from_commented_file_that_executes_another_file(
+ executor, pgspecial, tmpdir
+):
# https://github.com/dbcli/pgcli/issues/1336
sqlfile1 = tmpdir.join("test01.sql")
sqlfile1.write("-- asdf \n\\h")
@@ -296,7 +299,8 @@ def test_execute_from_commented_file_that_executes_another_file(executor, pgspec
statement = "--comment\n\\h"
result = run(executor, statement, pgspecial=cli.pgspecial)
assert result != None
- assert result[0].find("ALTER TABLE")
+ assert result[0].find("ALTER TABLE")
+
@dbtest
def test_execute_commented_first_line_and_special(executor, pgspecial, tmpdir):
@@ -316,7 +320,7 @@ def test_execute_commented_first_line_and_special(executor, pgspecial, tmpdir):
statement = "/*comment\ncomment line2*/\nselect now();"
result = run(executor, statement, pgspecial=pgspecial)
assert result != None
- assert result[1].find("now") >= 0
+ assert result[1].find("now") >= 0
statement = "--comment\n\\h"
result = run(executor, statement, pgspecial=pgspecial)