def test_initialize_sql(db): good_sql = 'SELECT * FROM %s' % TBL bad_sql = 'ALTER TABLE %s ADD "newcol" varchar' % TBL assert isinstance(database.initialize_sql(db, good_sql), str) with pytest.raises(AttributeError): database.initialize_sql(db, bad_sql)
def initialize(self, db, sql): self.sql = sql self.select = database.initialize_sql(db, sql) self.db = db