def test_selection(self):
        p = precursor.GeneralPrecursor("precursor_2", [])
        self.assertIsNone(p.get_selected_peakgroup())
        self.assertIsNone(p.get_best_peakgroup())

        pg = PeakGroupBase()
        pg.cluster_id_ = 1
        pg.id_ = "someID"
        pg.normalized_retentiontime = 100
        p.add_peakgroup(pg)
        self.assertEqual(len(list(p.get_all_peakgroups())), 1)

        pg = PeakGroupBase()
        pg.cluster_id_ = 2
        pg.id_ = "someID_"
        pg.normalized_retentiontime = 105
        p.add_peakgroup(pg)
        self.assertEqual(len(list(p.get_all_peakgroups())), 2)

        self.assertEqual(p.get_selected_peakgroup().get_feature_id(), "someID")
        self.assertEqual(p.get_best_peakgroup().get_feature_id(), "someID_")
        self.assertEqual(p.find_closest_in_iRT(99).get_feature_id(), "someID")
        self.assertEqual(
            p.find_closest_in_iRT(110).get_feature_id(), "someID_")
        self.assertEqual(
            p.find_closest_in_iRT(102.8).get_feature_id(), "someID_")
    def test_append(self):

        # TODO is this even used anywhere ???
        pg = MockPeakGroup(1, "precursor_2")
        p = precursor.GeneralPrecursor("precursor_2", [])
        p.append(pg)
        self.assertEqual(len(list(p.get_all_peakgroups())), 1)
    def test_selectpg(self):
        pg = PeakGroupBase()
        pg.cluster_id_ = 4
        pg.id_ = "someID"
        p = precursor.GeneralPrecursor("precursor_2", [])
        p.add_peakgroup(pg)
        self.assertEqual(len(list(p.get_all_peakgroups())), 1)

        firstpg = list(p.get_all_peakgroups())[0]
        self.assertEqual(firstpg.get_cluster_id(), 4)
    def test_add_peakgroup(self):

        pg = PeakGroupBase()
        p = precursor.GeneralPrecursor("precursor_2", [])
        p.add_peakgroup(pg)
        self.assertEqual(len(list(p.get_all_peakgroups())), 1)
 def test_get_id(self):
     p = precursor.GeneralPrecursor("precursor_2", [])
     self.assertEqual(p.get_id(), "precursor_2")
 def test_create_precursor(self):
     p = precursor.GeneralPrecursor("precursor_2", [])
     self.assertTrue(True)