From 47406ca9245d8e3b89cec737cb7a0e4f820eae4b Mon Sep 17 00:00:00 2001 From: Jonathan Ellis Date: Mon, 30 Jul 2007 19:14:08 +0000 Subject: [PATCH] test for table_names --- test/engine/reflection.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/test/engine/reflection.py b/test/engine/reflection.py index 73f6631353..9466b2a284 100644 --- a/test/engine/reflection.py +++ b/test/engine/reflection.py @@ -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 -- 2.47.3