def test_get_param_matrix_coords(self): """return correct coords for continuous-time models""" f81 = F81() self.assertEqual(f81.get_param_matrix_coords(), {}) self.assertTrue( len(f81.get_param_matrix_coords(include_ref_cell=True)["ref_cell"]) == 12 ) hky85 = HKY85() coords = hky85.get_param_matrix_coords() self.assertEqual(set(coords), set(["kappa"])) coords = hky85.get_param_matrix_coords(include_ref_cell=True) self.assertEqual(set(coords), set(["kappa", "ref_cell"])) gn = GN() coords = gn.get_param_matrix_coords(include_ref_cell=True) self.assertTrue(len(coords) == 12) self.assertTrue(len(coords["ref_cell"]) == 1)
def test_get_model(self): """get_models successfully creates model instances""" # just returns query if it's already a substitution model for mod in (CNFGTR(), WG01(), GN()): got = get_model(mod) self.assertEqual(id(got), id(mod)) with self.assertRaises(ValueError): # unknown model raises exception _ = get_model("blah")
def test_to_rich_dict(self): """returns complete dict of attributes""" f81 = F81().to_rich_dict() hky85 = HKY85().to_rich_dict() gn = GN().to_rich_dict()