Skip to content

Commit 06de3e7

Browse files
committed
Replace does_index_exist with db.sql_index_exists.
Use pre-existing function and remove the one I wrote.
1 parent ca28160 commit 06de3e7

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

test/test_postgresql.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,6 @@ def tearDown(self):
6868
DBTest.tearDown(self)
6969
postgresqlOpener.tearDown(self)
7070

71-
def does_index_exist(self, index_name):
72-
sql = """SELECT count(*) > 0
73-
FROM pg_class c
74-
WHERE c.relname = '%s'
75-
AND c.relkind = 'i';""" % index_name
76-
77-
self.db.sql(sql)
78-
return self.db.cursor.fetchone()[0]
79-
8071
def testUpgrade_6_to_7(self):
8172

8273
# load the database
@@ -113,7 +104,7 @@ def testUpgrade_6_to_7(self):
113104
self.db.sql("select * from _fts")
114105
self.db.rollback()
115106

116-
self.assertFalse(self.does_index_exist('__fts_idx'))
107+
self.assertFalse(self.db.sql_index_exists('__fts', '__fts_idx'))
117108

118109
if hasattr(self, "downgrade_only"):
119110
return
@@ -132,7 +123,7 @@ def testUpgrade_6_to_7(self):
132123
# clean db handle
133124
self.db.rollback()
134125

135-
self.assertTrue(self.does_index_exist('__fts_idx'))
126+
self.assertTrue(self.db.sql_index_exists('__fts', '__fts_idx'))
136127

137128
self.db.sql("select * from __fts")
138129

0 commit comments

Comments
 (0)