From: Jonathan Ellis Date: Mon, 30 Jul 2007 19:14:08 +0000 (+0000) Subject: test for table_names X-Git-Tag: rel_0_4beta1~143 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=47406ca9245d8e3b89cec737cb7a0e4f820eae4b;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git test for table_names --- 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