[Python-modules-commits] [python-pgspecial] 01/06: Import python-pgspecial_1.9.0.orig.tar.gz

ChangZhuo Chen czchen at moszumanska.debian.org
Mon Oct 30 02:14:10 UTC 2017


This is an automated email from the git hooks/post-receive script.

czchen pushed a commit to branch master
in repository python-pgspecial.

commit eb4f648d2c921468911e65cb4678b490450593b0
Author: ChangZhuo Chen (陳昌倬) <czchen at debian.org>
Date:   Mon Oct 30 09:20:02 2017 +0800

    Import python-pgspecial_1.9.0.orig.tar.gz
---
 License.txt                                        |  27 ++++++
 MANIFEST.in                                        |   1 +
 PKG-INFO                                           |  12 +--
 README.rst                                         |   6 +-
 pgspecial.egg-info/PKG-INFO                        |  12 +--
 pgspecial.egg-info/SOURCES.txt                     |   6 +-
 pgspecial/__init__.py                              |   2 +-
 pgspecial/dbcommands.py                            |  59 +++++++++---
 pgspecial/iocommands.py                            |   6 +-
 pgspecial/main.py                                  |   1 +
 setup.py                                           |   4 +-
 tests/__pycache__/conftest.cpython-33-PYTEST.pyc   | Bin 0 -> 1932 bytes
 tests/__pycache__/dbutils.cpython-33.pyc           | Bin 0 -> 3029 bytes
 .../test_specials.cpython-27-PYTEST.pyc            | Bin 32806 -> 35944 bytes
 .../test_specials.cpython-33-PYTEST.pyc            | Bin 0 -> 42787 bytes
 tests/dbutils.py                                   |   3 +
 tests/dbutils.pyc                                  | Bin 2692 -> 2919 bytes
 tests/test_specials.py                             | 101 +++++++++++++++++----
 18 files changed, 185 insertions(+), 55 deletions(-)

diff --git a/License.txt b/License.txt
new file mode 100644
index 0000000..087af3a
--- /dev/null
+++ b/License.txt
@@ -0,0 +1,27 @@
+Copyright (c) 2015, dbcli
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+  list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+  this list of conditions and the following disclaimer in the documentation
+  and/or other materials provided with the distribution.
+
+* Neither the name of pgspecial nor the names of its
+  contributors may be used to endorse or promote products derived from
+  this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/MANIFEST.in b/MANIFEST.in
index 37f630a..47eb971 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1 +1,2 @@
+include License.txt
 recursive-include tests *
diff --git a/PKG-INFO b/PKG-INFO
index d557cc3..30f0d79 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,10 +1,10 @@
 Metadata-Version: 1.1
 Name: pgspecial
-Version: 1.8.0
+Version: 1.9.0
 Summary: Meta-commands handler for Postgres Database.
 Home-page: http://pgcli.com
-Author: Amjith Ramanujam
-Author-email: amjith[dot]r[at]gmail.com
+Author: Pgcli Core Team
+Author-email: pgcli-dev at googlegroups.com
 License: LICENSE.txt
 Description: Meta-commands for Postgres
         --------------------------
@@ -30,14 +30,14 @@ Description: Meta-commands for Postgres
         Once this library is included into your project, you will most likely use the
         following imports:
         
-        ::
+        .. code-block:: python
         
             from pgspecial.main import PGSpecial
             from pgspecial.namedqueries import NamedQueries
         
         Then you will create and use an instance of PGSpecial:
         
-        ::
+        .. code-block:: python
         
                 pgspecial = PGSpecial()
                 for result in pgspecial.execute(cur, sql):
@@ -47,7 +47,7 @@ Description: Meta-commands for Postgres
         convenient to initialize and keep around the class variable in
         ``NamedQueries``:
         
-        ::
+        .. code-block:: python
         
             from configobj import ConfigObj
         
diff --git a/README.rst b/README.rst
index a1430aa..baed720 100644
--- a/README.rst
+++ b/README.rst
@@ -22,14 +22,14 @@ Usage
 Once this library is included into your project, you will most likely use the
 following imports:
 
-::
+.. code-block:: python
 
     from pgspecial.main import PGSpecial
     from pgspecial.namedqueries import NamedQueries
 
 Then you will create and use an instance of PGSpecial:
 
-::
+.. code-block:: python
 
         pgspecial = PGSpecial()
         for result in pgspecial.execute(cur, sql):
@@ -39,7 +39,7 @@ If you want to import named queries from an existing config file, it is
 convenient to initialize and keep around the class variable in
 ``NamedQueries``:
 
-::
+.. code-block:: python
 
     from configobj import ConfigObj
 
diff --git a/pgspecial.egg-info/PKG-INFO b/pgspecial.egg-info/PKG-INFO
index d557cc3..30f0d79 100644
--- a/pgspecial.egg-info/PKG-INFO
+++ b/pgspecial.egg-info/PKG-INFO
@@ -1,10 +1,10 @@
 Metadata-Version: 1.1
 Name: pgspecial
-Version: 1.8.0
+Version: 1.9.0
 Summary: Meta-commands handler for Postgres Database.
 Home-page: http://pgcli.com
-Author: Amjith Ramanujam
-Author-email: amjith[dot]r[at]gmail.com
+Author: Pgcli Core Team
+Author-email: pgcli-dev at googlegroups.com
 License: LICENSE.txt
 Description: Meta-commands for Postgres
         --------------------------
@@ -30,14 +30,14 @@ Description: Meta-commands for Postgres
         Once this library is included into your project, you will most likely use the
         following imports:
         
-        ::
+        .. code-block:: python
         
             from pgspecial.main import PGSpecial
             from pgspecial.namedqueries import NamedQueries
         
         Then you will create and use an instance of PGSpecial:
         
-        ::
+        .. code-block:: python
         
                 pgspecial = PGSpecial()
                 for result in pgspecial.execute(cur, sql):
@@ -47,7 +47,7 @@ Description: Meta-commands for Postgres
         convenient to initialize and keep around the class variable in
         ``NamedQueries``:
         
-        ::
+        .. code-block:: python
         
             from configobj import ConfigObj
         
diff --git a/pgspecial.egg-info/SOURCES.txt b/pgspecial.egg-info/SOURCES.txt
index bf0cff6..ade06bb 100644
--- a/pgspecial.egg-info/SOURCES.txt
+++ b/pgspecial.egg-info/SOURCES.txt
@@ -1,3 +1,4 @@
+License.txt
 MANIFEST.in
 README.rst
 setup.py
@@ -20,4 +21,7 @@ tests/pytest.ini
 tests/test_specials.py
 tests/.cache/v/cache/lastfailed
 tests/__pycache__/conftest.cpython-27-PYTEST.pyc
-tests/__pycache__/test_specials.cpython-27-PYTEST.pyc
\ No newline at end of file
+tests/__pycache__/conftest.cpython-33-PYTEST.pyc
+tests/__pycache__/dbutils.cpython-33.pyc
+tests/__pycache__/test_specials.cpython-27-PYTEST.pyc
+tests/__pycache__/test_specials.cpython-33-PYTEST.pyc
\ No newline at end of file
diff --git a/pgspecial/__init__.py b/pgspecial/__init__.py
index 8851104..319eb53 100644
--- a/pgspecial/__init__.py
+++ b/pgspecial/__init__.py
@@ -1,5 +1,5 @@
 __all__ = []
-__version__ = '1.8.0'
+__version__ = '1.9.0'
 
 
 def export(defn):
diff --git a/pgspecial/dbcommands.py b/pgspecial/dbcommands.py
index 99b6208..0184e9d 100644
--- a/pgspecial/dbcommands.py
+++ b/pgspecial/dbcommands.py
@@ -10,9 +10,37 @@ TableInfo = namedtuple("TableInfo", ['checks', 'relkind', 'hasindex',
 log = logging.getLogger(__name__)
 
 
- at special_command('\\l', '\\l', 'List databases.', arg_type=RAW_QUERY)
-def list_databases(cur, **_):
-    query = 'SELECT datname FROM pg_database;'
+ at special_command('\\l', '\\l[+] [pattern]', 'List databases.', aliases=('\\list',))
+def list_databases(cur, pattern, verbose):
+    query = '''SELECT d.datname as "Name",
+        pg_catalog.pg_get_userbyid(d.datdba) as "Owner",
+        pg_catalog.pg_encoding_to_char(d.encoding) as "Encoding",
+        d.datcollate as "Collate",
+        d.datctype as "Ctype",
+        pg_catalog.array_to_string(d.datacl, E'\n') AS "Access privileges"'''
+    if verbose:
+        query += ''',
+            CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT')
+                    THEN pg_catalog.pg_size_pretty(pg_catalog.pg_database_size(d.datname))
+                    ELSE 'No Access'
+            END as "Size",
+            t.spcname as "Tablespace",
+            pg_catalog.shobj_description(d.oid, 'pg_database') as "Description"'''
+    query += '''
+    FROM pg_catalog.pg_database d
+    '''
+    if verbose:
+        query += '''
+        JOIN pg_catalog.pg_tablespace t on d.dattablespace = t.oid
+        '''
+    params = []
+    if pattern:
+        query += '''
+        WHERE d.datname ~ %s
+        '''
+        _, schema = sql_name_pattern(pattern)
+        params.append(schema)
+    query = cur.mogrify(query + ' ORDER BY 1', params)
     cur.execute(query)
     if cur.description:
         headers = [x[0] for x in cur.description]
@@ -924,6 +952,7 @@ def describe_one_table_details(cur, schema_name, relation_name, oid, verbose):
 
                 #/* If exclusion constraint, print the constraintdef */
                 if row[7] == "x":
+                    status.append(' ')
                     status.append(row[6])
                 else:
                     #/* Label as primary key or unique (but not both) */
@@ -1149,7 +1178,7 @@ def describe_one_table_details(cur, schema_name, relation_name, oid, verbose):
     #*/
     if (tableinfo.relkind == 'r' or tableinfo.relkind == 'm' or
             tableinfo.relkind == 'f'):
-        # /* print foreign server name */
+        #/* print foreign server name */
         if tableinfo.relkind == 'f':
             #/* Footer information about foreign table */
             sql = ("SELECT s.srvname,\n"
@@ -1164,10 +1193,10 @@ def describe_one_table_details(cur, schema_name, relation_name, oid, verbose):
             cur.execute(sql)
             row = cur.fetchone()
 
-            # /* Print server name */
+            #/* Print server name */
             status.append("Server: %s\n" % row[0])
 
-            # /* Print per-table FDW options, if any */
+            #/* Print per-table FDW options, if any */
             if (row[1]):
                 status.append("FDW Options: (%s)\n" % row[1])
 
@@ -1211,16 +1240,20 @@ def describe_one_table_details(cur, schema_name, relation_name, oid, verbose):
             #/* print the number of child tables, if any */
             if (cur.rowcount > 0):
                 status.append("Number of child tables: %d (Use \d+ to list"
-                    "them.)\n" % cur.rowcount)
+                              " them.)\n" % cur.rowcount)
         else:
-            spacer = ''
-            if (cur.rowcount >0):
+            if (cur.rowcount > 0):
                 status.append('Child tables')
 
-            #/* display the list of child tables */
-            for row in cur:
-                status.append("%s: %s,\n" % (spacer, row))
-                spacer = ' ' * len('Child tables')
+                spacer = ':'
+                trailer = ',\n'
+                #/* display the list of child tables */
+                for idx, row in enumerate(cur, 1):
+                    if idx == 2:
+                        spacer = ' ' * (len('Child tables') + 1)
+                    if idx == cur.rowcount:
+                        trailer = '\n'
+                    status.append("%s %s%s" % (spacer, row[0], trailer))
 
         #/* Table type */
         if (tableinfo.reloftype):
diff --git a/pgspecial/iocommands.py b/pgspecial/iocommands.py
index 5544a70..fd57af0 100644
--- a/pgspecial/iocommands.py
+++ b/pgspecial/iocommands.py
@@ -23,7 +23,7 @@ def editor_command(command):
     """
     # It is possible to have `\e filename` or `SELECT * FROM \e`. So we check
     # for both conditions.
-    return command.strip().endswith('\\e') or command.strip().startswith('\\e')
+    return command.strip().endswith('\\e') or command.strip().startswith('\\e ')
 
 
 @export
@@ -35,7 +35,7 @@ def get_filename(sql):
 
 @export
 def get_watch_command(command):
-    match = re.match("(.*) \\\\watch (\d+);?$", command)
+    match = re.match("(.*?)[\s]*\\\\watch (\d+);?$", command)
     if match:
         groups = match.groups()
         return groups[0], int(groups[1])
@@ -73,7 +73,7 @@ def open_external_editor(filename=None, sql=None):
 
     # Populate the editor buffer with the partial sql (if available) and a
     # placeholder comment.
-    query = click.edit('{sql}\n\n{marker}'.format(sql=sql, marker=MARKER),
+    query = click.edit(u'{sql}\n\n{marker}'.format(sql=sql, marker=MARKER),
                        filename=filename, extension='.sql')
 
     if filename:
diff --git a/pgspecial/main.py b/pgspecial/main.py
index d9e0f02..ccc8a49 100644
--- a/pgspecial/main.py
+++ b/pgspecial/main.py
@@ -240,6 +240,7 @@ def doc_only():
 
 
 @special_command('\\ef', '\\ef [funcname [line]]', 'Edit the contents of the query buffer.', arg_type=NO_QUERY, hidden=True)
+ at special_command('\\ev', '\\ev [viewname [line]]', 'Edit the contents of the query buffer.', arg_type=NO_QUERY, hidden=True)
 @special_command('\\do', '\\do[S] [pattern]', 'List operators.', arg_type=NO_QUERY, hidden=True)
 @special_command('\\dp', '\\dp [pattern]', 'List table, view, and sequence access privileges.', arg_type=NO_QUERY, hidden=True)
 @special_command('\\z', '\\z [pattern]', 'Same as \\dp.', arg_type=NO_QUERY, hidden=True)
diff --git a/setup.py b/setup.py
index b93182f..adc21f5 100644
--- a/setup.py
+++ b/setup.py
@@ -13,8 +13,8 @@ description = 'Meta-commands handler for Postgres Database.'
 
 setup(
         name='pgspecial',
-        author='Amjith Ramanujam',
-        author_email='amjith[dot]r[at]gmail.com',
+        author='Pgcli Core Team',
+        author_email='pgcli-dev at googlegroups.com',
         version=version,
         license='LICENSE.txt',
         url='http://pgcli.com',
diff --git a/tests/__pycache__/conftest.cpython-33-PYTEST.pyc b/tests/__pycache__/conftest.cpython-33-PYTEST.pyc
new file mode 100644
index 0000000..43fca4b
Binary files /dev/null and b/tests/__pycache__/conftest.cpython-33-PYTEST.pyc differ
diff --git a/tests/__pycache__/dbutils.cpython-33.pyc b/tests/__pycache__/dbutils.cpython-33.pyc
new file mode 100644
index 0000000..b9ab000
Binary files /dev/null and b/tests/__pycache__/dbutils.cpython-33.pyc differ
diff --git a/tests/__pycache__/test_specials.cpython-27-PYTEST.pyc b/tests/__pycache__/test_specials.cpython-27-PYTEST.pyc
index 7f67762..fbdaa3a 100644
Binary files a/tests/__pycache__/test_specials.cpython-27-PYTEST.pyc and b/tests/__pycache__/test_specials.cpython-27-PYTEST.pyc differ
diff --git a/tests/__pycache__/test_specials.cpython-33-PYTEST.pyc b/tests/__pycache__/test_specials.cpython-33-PYTEST.pyc
new file mode 100644
index 0000000..f7cfc5a
Binary files /dev/null and b/tests/__pycache__/test_specials.cpython-33-PYTEST.pyc differ
diff --git a/tests/dbutils.py b/tests/dbutils.py
index a454f65..8df4ec8 100644
--- a/tests/dbutils.py
+++ b/tests/dbutils.py
@@ -47,6 +47,9 @@ def setup_db(conn):
         cur.execute('create table tbl1(id1 integer, txt1 text, CONSTRAINT id_text PRIMARY KEY(id1, txt1))')
         cur.execute('create table tbl2(id2 serial, txt2 text)')
         cur.execute('create table schema1.s1_tbl1(id1 integer, txt1 text)')
+        cur.execute('create table tbl3(c3 circle, exclude using gist (c3 with &&))')
+        cur.execute('create table "Inh1"(value1 integer) inherits (tbl1)')
+        cur.execute('create table inh2(value2 integer) inherits (tbl1, tbl2)')
 
         # views
         cur.execute('create view vw1 as select * from tbl1')
diff --git a/tests/dbutils.pyc b/tests/dbutils.pyc
index 9aaa852..6d6d5a2 100644
Binary files a/tests/dbutils.pyc and b/tests/dbutils.pyc differ
diff --git a/tests/test_specials.py b/tests/test_specials.py
index 4b4aa6f..6886326 100644
--- a/tests/test_specials.py
+++ b/tests/test_specials.py
@@ -11,13 +11,16 @@ objects_listing_headers = ['Schema', 'Name', 'Type', 'Owner', 'Size', 'Descripti
 def test_slash_d(executor):
     results = executor('\d')
     title = None
-    rows = [('public', 'mvw1', 'materialized view', POSTGRES_USER),
+    rows = [('public', 'Inh1', 'table', POSTGRES_USER),
+            ('public', 'inh2', 'table', POSTGRES_USER),
+            ('public', 'mvw1', 'materialized view', POSTGRES_USER),
             ('public', 'tbl1', 'table', POSTGRES_USER),
             ('public', 'tbl2', 'table', POSTGRES_USER),
             ('public', 'tbl2_id2_seq', 'sequence', POSTGRES_USER),
+            ('public', 'tbl3', 'table', POSTGRES_USER),
             ('public', 'vw1', 'view', POSTGRES_USER)]
     headers = objects_listing_headers[:-2]
-    status = 'SELECT 5'
+    status = 'SELECT 8'
     expected = [title, rows, headers, status]
 
     assert results == expected
@@ -27,40 +30,90 @@ def test_slash_d(executor):
 def test_slash_d_verbose(executor):
     results = executor('\d+')
     title = None
-    rows = [('public', 'mvw1', 'materialized view', POSTGRES_USER, '8192 bytes', None),
+    rows = [('public', 'Inh1', 'table', POSTGRES_USER, '8192 bytes', None),
+            ('public', 'inh2', 'table', POSTGRES_USER, '8192 bytes', None),
+            ('public', 'mvw1', 'materialized view',
+             POSTGRES_USER, '8192 bytes', None),
             ('public', 'tbl1', 'table', POSTGRES_USER, '8192 bytes', None),
             ('public', 'tbl2', 'table', POSTGRES_USER, '8192 bytes', None),
-            ('public', 'tbl2_id2_seq', 'sequence', POSTGRES_USER, '8192 bytes', None),
+            ('public', 'tbl2_id2_seq', 'sequence',
+             POSTGRES_USER, '8192 bytes', None),
+            ('public', 'tbl3', 'table', POSTGRES_USER, '0 bytes', None),
             ('public', 'vw1', 'view', POSTGRES_USER, '0 bytes', None)]
     headers = objects_listing_headers
-    status = 'SELECT 5'
+    status = 'SELECT 8'
     expected = [title, rows, headers, status]
 
     assert results == expected
 
 
 @dbtest
-def test_slash_d_table(executor):
+def test_slash_d_table_1(executor):
     results = executor('\d tbl1')
     title = None
     rows = [['id1', 'integer', ' not null'],
             ['txt1', 'text', ' not null'],
             ]
     headers = ['Column', 'Type', 'Modifiers']
-    status = 'Indexes:\n    "id_text" PRIMARY KEY, btree (id1, txt1)\n'
+    status = ('Indexes:\n    "id_text" PRIMARY KEY, btree (id1, txt1)\n'
+              'Number of child tables: 2 (Use \\d+ to list them.)\n')
+    expected = [title, rows, headers, status]
+    assert results == expected
+
+
+ at dbtest
+def test_slash_d_table_2(executor):
+    results = executor('\d tbl2')
+    title = None
+    rows = [['id2', 'integer', " not null default nextval('tbl2_id2_seq'::regclass)"],
+            ['txt2', 'text', ''],
+            ]
+    headers = ['Column', 'Type', 'Modifiers']
+    status = ('Number of child tables: 1 (Use \\d+ to list them.)\n')
     expected = [title, rows, headers, status]
     assert results == expected
 
 
 @dbtest
-def test_slash_d_table_verbose(executor):
+def test_slash_d_table_verbose_1(executor):
     results = executor('\d+ tbl1')
     title = None
     rows = [['id1', 'integer', ' not null', 'plain', None, None],
             ['txt1', 'text', ' not null', 'extended', None, None],
             ]
-    headers = ['Column', 'Type', 'Modifiers', 'Storage', 'Stats target', 'Description']
-    status = 'Indexes:\n    "id_text" PRIMARY KEY, btree (id1, txt1)\nHas OIDs: no\n'
+    headers = ['Column', 'Type', 'Modifiers',
+               'Storage', 'Stats target', 'Description']
+    status = ('Indexes:\n    "id_text" PRIMARY KEY, btree (id1, txt1)\n'
+              'Child tables: "Inh1",\n'
+              '              inh2\n'
+              'Has OIDs: no\n')
+    expected = [title, rows, headers, status]
+    assert results == expected
+
+
+ at dbtest
+def test_slash_d_table_verbose_2(executor):
+    results = executor('\d+ tbl2')
+    title = None
+    rows = [['id2', 'integer', " not null default nextval('tbl2_id2_seq'::regclass)",
+             'plain', None, None],
+            ['txt2', 'text', '', 'extended', None, None],
+            ]
+    headers = ['Column', 'Type', 'Modifiers',
+               'Storage', 'Stats target', 'Description']
+    status = ('Child tables: inh2\n'
+              'Has OIDs: no\n')
+    expected = [title, rows, headers, status]
+    assert results == expected
+
+
+ at dbtest
+def test_slash_d_table_with_exclusion(executor):
+    results = executor('\d tbl3')
+    title = None
+    rows = [['c3', 'circle', '']]
+    headers = ['Column', 'Type', 'Modifiers']
+    status = 'Indexes:\n    "tbl3_c3_excl" EXCLUDE USING gist (c3 WITH &&)\n'
     expected = [title, rows, headers, status]
     assert results == expected
 
@@ -84,10 +137,13 @@ def test_slash_dt(executor):
     """List all tables in public schema."""
     results = executor('\dt')
     title = None
-    rows = [('public', 'tbl1', 'table', POSTGRES_USER),
-            ('public', 'tbl2', 'table', POSTGRES_USER)]
+    rows = [('public', 'Inh1', 'table', POSTGRES_USER),
+            ('public', 'inh2', 'table', POSTGRES_USER),
+            ('public', 'tbl1', 'table', POSTGRES_USER),
+            ('public', 'tbl2', 'table', POSTGRES_USER),
+            ('public', 'tbl3', 'table', POSTGRES_USER)]
     headers = objects_listing_headers[:-2]
-    status = 'SELECT 2'
+    status = 'SELECT 5'
     expected = [title, rows, headers, status]
     assert results == expected
 
@@ -97,10 +153,13 @@ def test_slash_dt_verbose(executor):
     """List all tables in public schema in verbose mode."""
     results = executor('\dt+')
     title = None
-    rows = [('public', 'tbl1', 'table', POSTGRES_USER, '8192 bytes', None),
-            ('public', 'tbl2', 'table', POSTGRES_USER, '8192 bytes', None)]
+    rows = [('public', 'Inh1', 'table', POSTGRES_USER, '8192 bytes', None),
+            ('public', 'inh2', 'table', POSTGRES_USER, '8192 bytes', None),
+            ('public', 'tbl1', 'table', POSTGRES_USER, '8192 bytes', None),
+            ('public', 'tbl2', 'table', POSTGRES_USER, '8192 bytes', None),
+            ('public', 'tbl3', 'table', POSTGRES_USER, '0 bytes', None)]
     headers = objects_listing_headers
-    status = 'SELECT 2'
+    status = 'SELECT 5'
     expected = [title, rows, headers, status]
     assert results == expected
 
@@ -182,9 +241,10 @@ def test_slash_di(executor):
     """List all indexes in public schema."""
     results = executor('\di')
     title = None
-    row = [('public', 'id_text', 'index', POSTGRES_USER)]
+    row = [('public', 'id_text', 'index', POSTGRES_USER),
+           ('public', 'tbl3_c3_excl', 'index', POSTGRES_USER)]
     headers = objects_listing_headers[:-2]
-    status = 'SELECT 1'
+    status = 'SELECT 2'
     expected = [title, row, headers, status]
     assert results == expected
 
@@ -194,9 +254,10 @@ def test_slash_di_verbose(executor):
     """List all indexes in public schema in verbose mode."""
     results = executor('\di+')
     title = None
-    row = [('public', 'id_text', 'index', POSTGRES_USER, '8192 bytes', None)]
+    row = [('public', 'id_text', 'index', POSTGRES_USER, '8192 bytes', None),
+           ('public', 'tbl3_c3_excl', 'index', POSTGRES_USER, '8192 bytes', None)]
     headers = objects_listing_headers
-    status = 'SELECT 1'
+    status = 'SELECT 2'
     expected = [title, row, headers, status]
     assert results == expected
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-pgspecial.git



More information about the Python-modules-commits mailing list