mirror of https://github.com/dbcli/pgcli
Pep8.
This commit is contained in:
parent
4b06769002
commit
a26b8b92a2
|
@ -406,7 +406,7 @@ class PGExecute(object):
|
|||
return cur.fetchone()[0]
|
||||
|
||||
def view_definition(self, spec):
|
||||
"""Returns the SQL defining views described by `spec` """
|
||||
"""Returns the SQL defining views described by `spec`"""
|
||||
|
||||
template = 'CREATE OR REPLACE {6} VIEW {0}.{1} AS \n{3}'
|
||||
# 2: relkind, v or m (materialized)
|
||||
|
@ -425,7 +425,7 @@ class PGExecute(object):
|
|||
return template.format(*result + (view_type,))
|
||||
|
||||
def function_definition(self, spec):
|
||||
"""Returns the SQL defining functions described by `spec` """
|
||||
"""Returns the SQL defining functions described by `spec`"""
|
||||
|
||||
with self.conn.cursor() as cur:
|
||||
sql = self.function_definition_query
|
||||
|
|
|
@ -361,6 +361,7 @@ def test_on_error_stop(executor, exception_formatter):
|
|||
# result = list(executor.run(sql))
|
||||
# assert result[0][0] == u'NOTICE: 有人更改\n'
|
||||
|
||||
|
||||
@dbtest
|
||||
def test_nonexistent_function_definition(executor):
|
||||
with pytest.raises(RuntimeError):
|
||||
|
@ -379,6 +380,7 @@ def test_function_definition(executor):
|
|||
''')
|
||||
result = executor.function_definition('the_number_three')
|
||||
|
||||
|
||||
@dbtest
|
||||
def test_view_definition(executor):
|
||||
run(executor, 'create table tbl1 (a text, b numeric)')
|
||||
|
@ -390,10 +392,10 @@ def test_view_definition(executor):
|
|||
result = executor.view_definition('mvw1')
|
||||
assert 'MATERIALIZED VIEW' in result
|
||||
|
||||
|
||||
@dbtest
|
||||
def test_nonexistent_view_definition(executor):
|
||||
with pytest.raises(RuntimeError):
|
||||
result = executor.view_definition('there_is_no_such_view')
|
||||
with pytest.raises(RuntimeError):
|
||||
result = executor.view_definition('mvw1')
|
||||
|
||||
|
|
Loading…
Reference in New Issue