]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
test for table_names
authorJonathan Ellis <jbellis@gmail.com>
Mon, 30 Jul 2007 19:14:08 +0000 (19:14 +0000)
committerJonathan Ellis <jbellis@gmail.com>
Mon, 30 Jul 2007 19:14:08 +0000 (19:14 +0000)
test/engine/reflection.py

index 73f66313539bc94d2012e3ac48503c89c27be83d..9466b2a2848dbb46c59ce06bc3e7dcfec3116100 100644 (file)
@@ -605,9 +605,19 @@ class CreateDropTest(PersistTest):
 
         metadata.drop_all(bind=testbase.db)
         self.assertEqual( testbase.db.has_table('items'), False )
-        self.assertEqual( testbase.db.has_table('email_addresses'), False )                
+        self.assertEqual( testbase.db.has_table('email_addresses'), False )
         metadata.drop_all(bind=testbase.db)
-        self.assertEqual( testbase.db.has_table('items'), False )                
+        self.assertEqual( testbase.db.has_table('items'), False )
+
+    def test_tablenames(self):
+        from sqlalchemy.util import Set
+        metadata.create_all(bind=testbase.db)
+        # we only check to see if all the explicitly created tables are there, rather than
+        # assertEqual -- the test db could have "extra" tables if there is a misconfigured
+        # template.  (*cough* tsearch2 w/ the pg windows installer.)
+        self.assert_(not Set(metadata.tables) - Set(testbase.db.table_names()))
+        metadata.drop_all(bind=testbase.db)
+    
 
 class SchemaTest(PersistTest):
     # this test should really be in the sql tests somewhere, not engine