def test_insertIndividual(self): """test the insertion of a few individuals and populations """ session.flush() me = Individual('Giovanni') hannibal = Individual('Annibal') # create populations italians = Population('Italians') cartaginians = Population('Cartaginians') me.population = italians hannibal.population = cartaginians
def test_getandfilter(self): me = Individual('giovanni', population='italians') me_getby = Individual.get_by(name = 'GIOVANNI') assert me_getby == me me_filterby = session.query(Individual).filter_by(name = 'GIOVANNI') assert me_filterby[0] == me # The only way to do a case-indipendent search is by using .filter: me_filter = session.query(Individual).filter(Individual.name.like('giovanni')) assert me_filter[0] == me