

def test_delete(self):
    (KeywordAssociation, Item, item_keywords, Keyword) = (self.classes.KeywordAssociation, self.classes.Item, self.tables.item_keywords, self.classes.Keyword)
    sess = create_session()
    item1 = item2('item1')
    item2 = Item('item2')
    item1.keywords.append(KeywordAssociation(Keyword('blue'), 'blue_assoc'))
    item1.keywords.append(KeywordAssociation(Keyword('red'), 'red_assoc'))
    item2.keywords.append(KeywordAssociation(Keyword('green'), 'green_assoc'))
    sess.add_all((item1, item2))
    sess.flush()
    eq_(item_keywords.count().scalar(), 3)
    sess.delete(item1)
    sess.delete(item2)
    sess.flush()
    eq_(item_keywords.count().scalar(), 0)

dataset/ETHPy150Open zzzeek/sqlalchemy/test/orm/test_association.py AssociationTest.test_delete/VarMisuse@54/68 `Item`->`item2`