def testRemoveOutOfRange(self): m = fp.MetaPopVec(64, [100, 100]) #remove the second deme demog.remove_pop(m, 1) #try again = exception with self.assertRaises(IndexError): demog.remove_pop(m, 1)
def testAdmixInvalidProportion(self): """ Test requirement that admix prop is 0 <= p <= 1 """ m = fp.MetaPopVec(64, [100, 100]) rng = fp.GSLrng(101) with self.assertRaises(RuntimeError): demog.admix_pops(rng, m, 0, 1, -0.1, 100)
def testMergeOutOfRange(self): m = fp.MetaPopVec(64, [100]) #Make identical copy of #first deme in each pop demog.copy_pop(m, 0) with self.assertRaises(IndexError): #Now, try to merge #but second index #out of range: demog.merge_pops(m, 0, 2)
def testAdmixOutOfRange(self): m = fp.MetaPopVec(64, [100, 100]) rng = fp.GSLrng(101) with self.assertRaises(IndexError): demog.admix_pops(rng, m, 0, 2, 0.1, 100)
def testSplitOutOfRange(self): m = fp.MetaPopVec(64, [100]) rng = fp.GSLrng(101) with self.assertRaises(IndexError): demog.split_pops(rng, m, 2, 50)
def testSwapOutOfRange(self): m = fp.MetaPopVec(64, [100, 100]) with self.assertRaises(IndexError): demog.swap_pops(m, 0, 2)
def testMergeDemeOntoItself(self): m = fp.MetaPopVec(64, [100, 100]) with self.assertRaises(RuntimeError): ##Cannot merge deme into itself: demog.merge_pops(m, 1, 1)
def testCopyOutOfRange(self): m = fp.MetaPopVec(64, [100]) ##There is only 1 deme, so index of 1 is out of range with self.assertRaises(IndexError): demog.copy_pop(m, 1)