def test_discard_entity_with_none_handle(): db = EntityDB() e = DXFEntity() assert e.dxf.handle is None # call should not raise any Exception db.discard(e) # 2rd call should not raise any Exception db.discard(e)
def test_discard_contained_entity(): db = EntityDB() e = DXFEntity() db.add(e) assert len(db) == 1 db.discard(e) assert len(db) == 0 assert e.dxf.handle is None
def test_discard_entity_with_handle_not_in_database(): db = EntityDB() e = DXFEntity() e.dxf.handle = 'ABBA' assert e.dxf.handle not in db # call should not raise any Exception db.discard(e) # 2rd call should not raise any Exception db.discard(e) assert e.dxf.handle is 'ABBA', \ 'set handle to None, only if entity was removed'