def test_init_formula(self): """Return right fields""" isotopes = ip.IsotopeInfo(self.isotopes_file) formula = {"C": 21, "H": 28, "N": 7, "O": 14, "P": 2} charge = 1 ins = ip.MoleculeInfo(formula, charge, isotopes) self.assertIsInstance(ins, ip.MoleculeInfo)
def test_get_isotopes_from_elements(self): """Correct list of isotopes.""" iso = ip.IsotopeInfo(self.isotopes_file) ele = ["C", "O", "H"] res = iso.get_isotopes_from_elements(ele) res_corr = ["C12", "C13", "O16", "O17", "O18", "H01", "H02"] self.assertListEqual(res, res_corr)
def test_eq_false_type(self): """Test __eq__ for different types.""" molecule = ip.MoleculeInfo.get_molecule_info( molecule_name="Test1", molecules_file=self.molecules_file, isotopes_file=self.isotopes_file, ) iso = ip.IsotopeInfo(self.isotopes_file) self.assertFalse(molecule == iso)
def test_eq_false_type(self): """Test __eq__ for differnt types.""" data = {"C13": 2, "O18": 3, "H02": 2} label = ip.Label(data, self.molecule_info) iso = ip.IsotopeInfo(self.isotopes_file) self.assertFalse(label == iso)
def test_eq_false_type(self): """Test __eq__ for differnt types.""" iso = ip.IsotopeInfo(self.isotopes_file) other = {} self.assertFalse(iso == other)
def test_eq_false(self): """Test __eq__ for different IsotopeInfo Instance.""" isotopes_file2 = Path("tests/test_isotopes2.csv") iso1 = ip.IsotopeInfo(self.isotopes_file) iso2 = ip.IsotopeInfo(isotopes_file2) self.assertFalse(iso1 == iso2)
def test_eq_true(self): """Test __eq__ for same IsotopeInfo Instance.""" iso1 = ip.IsotopeInfo(self.isotopes_file) iso2 = ip.IsotopeInfo(self.isotopes_file) self.assertTrue(iso1 == iso2)
def test_init_attributes_type(self): """Type of instance attributes.""" instance = ip.IsotopeInfo(self.isotopes_file) self.assertIsInstance(instance.abundance, pandas.Series) self.assertIsInstance(instance.isotopes_file, Path) self.assertIsInstance(instance.isotope_mass_series, pandas.Series)