def test_det_limit(self): Mnd = bm.get_model(self.model_name, p_in=.5, p_out=0, opts=dict(no_det_limit=True)) Md = bm.get_model(self.model_name, p_in=.5, p_out=0, opts=dict(no_det_limit=False)) # Test the command line no-det-limit option works. argv = [ bm.__file__, self.model_name, '/nonexistant', # outdir '--graph-format=null', '--comm-format=null' ] Mnd2, args = bm.main_argv(argv=argv + ['--no-det-limit']) # Default shourd be detectability limit. Md2, args = bm.main_argv(argv=argv) assert_equal(len(Mnd.comms(0)), 3) assert_equal(len(Mnd.comms(1)), 4) assert_equal(len(Md.comms(0)), 3) assert_equal(len(Md.comms(1)), 3) assert_equal(len(Mnd2.comms(0)), 3) assert_equal(len(Mnd2.comms(1)), 4) assert_equal(len(Md2.comms(0)), 3) assert_equal(len(Md2.comms(1)), 3)
def test_num_comms(self): M = bm.get_model(self.model_name, p_in=.5, p_out=0) assert_equal(len(M.comms(0)), 4) assert_equal(len(M.comms(25)), 4) assert_equal(len(M.comms(50)), 3) assert_equal(len(M.comms(85)), 4) assert_equal(len(M.comms(100)), 4)
def test_ccs(self): M = bm.get_model(self.model_name, p_in=.5, p_out=0) g = M.t(0) assert_compnents(g, 4) g = M.t(50) assert_compnents(g, 3) g = M.t(25) assert_compnents(g, 3)
def test_Gnm(self): M = bm.get_model(self.model_name, p_in=.5, p_out=.5, opts=dict(Gnm=True)) edges = M.t(0).number_of_edges() expected_edges = 128 * 127 / 2 * .5 assert_almost_equals(edges, expected_edges, delta=5)
def test_ccs(self): M = bm.get_model(self.model_name, p_in=.5, p_out=0) g = M.t(0) assert_compnents(g, getattr(self, 'n_ccs', 4)) g = M.t(50) assert_compnents(g, getattr(self, 'n_ccs', 4)) g = M.t(25) assert_compnents(g, getattr(self, 'n_ccs_off', 4))
def test_det_limit(self): Mnd = bm.get_model(self.model_name, p_in=.5, p_out=0, opts=dict(no_det_limit=True)) Md = bm.get_model(self.model_name, p_in=.5, p_out=0, opts=dict(no_det_limit=False)) # Test the command line no-det-limit option works. argv = [bm.__file__, self.model_name, '/nonexistant', # outdir '--graph-format=null','--comm-format=null'] Mnd2, args = bm.main_argv(argv=argv+['--no-det-limit']) # Default shourd be detectability limit. Md2, args = bm.main_argv(argv=argv) assert_equal(len(Mnd.comms(0)), 3) assert_equal(len(Mnd.comms(1)), 4) assert_equal(len(Md.comms(0)), 3) assert_equal(len(Md.comms(1)), 3) assert_equal(len(Mnd2.comms(0)), 3) assert_equal(len(Mnd2.comms(1)), 4) assert_equal(len(Md2.comms(0)), 3) assert_equal(len(Md2.comms(1)), 3)
def test_all_managed(): assert_all_managed(bm.get_model('StdGrow')) assert_all_managed(bm.get_model('StdMerge')) assert_all_managed(bm.get_model('StdMixed')) assert_all_managed(bm.get_model('StdGrow', q=8)) assert_all_managed(bm.get_model('StdMerge', q=8)) assert_all_managed(bm.get_model('StdMixed', q=8))
def test_all_managed(): assert_all_managed(bm.get_model('StdGrow' )) assert_all_managed(bm.get_model('StdMerge')) assert_all_managed(bm.get_model('StdMixed')) assert_all_managed(bm.get_model('StdGrow' , q=8)) assert_all_managed(bm.get_model('StdMerge', q=8)) assert_all_managed(bm.get_model('StdMixed', q=8))
def getM(): return bm.get_model(self.model_name, p_in='k=15', p_out='ktot=45')
def getM(): return bm.get_model(self.model_name, p_in=.6, p_out=.6)
def test_ccs(self): M = bm.get_model(self.model_name, p_in=.5, p_out=0) g = M.t(0); assert_compnents(g, 4) g = M.t(50); assert_compnents(g, 3) g = M.t(25); assert_compnents(g, 3)
def getM(): return bm.get_model(self.model_name, p_in='k=20', p_out='k=5')
def test_Gnm(self): M = bm.get_model(self.model_name, p_in=.5, p_out=.5, opts=dict(Gnm=True)) edges = M.t(0).number_of_edges() expected_edges = 128*127 / 2 * .5 assert_almost_equals(edges, expected_edges, delta=5)
def test_size(self): M = bm.get_model(self.model_name) assert len(M.t(0)) == 128
def test_all_managed(self): assert_all_managed(bm.get_model(self.model_name)) assert_all_managed(bm.get_model(self.model_name, q=8)) assert_all_managed(bm.get_model(self.model_name, p_in=.5, p_out=.5))