コード例 #1
0
    def test_attribute_forwarder_integrity_after_copy(self):
        """ Integrity of attribute forwarding following a copy()"""
        dm = DistanceMatrix(data=self.m2, RowOrder=self.m2.keys(), info=self.aar)
        c = dm.copy()
       
        # dm.ID == '5'
        self.assertEqual(c.ID, dm.ID)
        self.assertEqual(c.Correlating, dm.Correlating)
        self.assertEqual(c.Data['R'], dm.Data['R'])

        c.ID = '0'
        self.assertNotEqual(c.ID,dm.ID)
コード例 #2
0
ファイル: test_distance.py プロジェクト: cxhernandez/pycogent
 def test_transpose(self):
     """ transpose functions as expected """
     for m in self.matrices:
         d = DistanceMatrix(data=m)
         t = d.copy()
         t.transpose()
         # Note, this line will fail on a matrix where transpose = original
         self.assertNotEqual(t, d)
         for r in t:
             for c in t[r]:
                 self.assertEqual(t[r][c], d[c][r])
         t.transpose()
         self.assertEqual(t, d)
コード例 #3
0
ファイル: test_distance.py プロジェクト: miklou/pycogent
 def test_transpose(self):
     """ transpose functions as expected """
     for m in self.matrices:
         d = DistanceMatrix(data=m)
         t = d.copy()
         t.transpose()
         # Note, this line will fail on a matrix where transpose = original
         self.assertNotEqual(t,d)
         for r in t:
             for c in t[r]:
                 self.assertEqual(t[r][c],d[c][r])
         t.transpose()
         self.assertEqual(t,d)
コード例 #4
0
    def test_copy(self):
        """ Copy functions as expected"""
        dm = DistanceMatrix(data=self.m2, RowOrder=self.m2.keys(), info=self.aar)
        c = dm.copy()
        self.assertEqual(c['A']['A'],dm['A']['A'])
        self.assertEqual(c.RowOrder,dm.RowOrder)
        self.assertEqual(c.ColOrder,dm.ColOrder)
        self.assertEqual(c.Pad,dm.Pad)
        self.assertEqual(c.Power,dm.Power)

        # Make sure it's a separate object
        c['A']['A'] = 999
        self.assertNotEqual(c['A']['A'],dm['A']['A'])
コード例 #5
0
ファイル: test_distance.py プロジェクト: cxhernandez/pycogent
 def test_reflect(self):
     """ reflect functions as expected """
     for m in self.matrices:
         d = DistanceMatrix(data=m)
         n = d.copy()
         # Only testing one method, all other are tested in superclass, so
         # redundant testing is probably not necessary
         n.reflect(method=largest)
         for r in d.RowOrder:
             for c in d.ColOrder:
                 if d[r][c] > d[c][r]:
                     goal = d[r][c]
                 else:
                     goal = d[c][r]
                 self.assertEqual(n[r][c], goal)
                 self.assertEqual(n[c][r], goal)
コード例 #6
0
ファイル: test_distance.py プロジェクト: miklou/pycogent
 def test_reflect(self):
     """ reflect functions as expected """
     for m in self.matrices:
         d = DistanceMatrix(data=m)
         n = d.copy()
         # Only testing one method, all other are tested in superclass, so
         # redundant testing is probably not necessary
         n.reflect(method=largest)
         for r in d.RowOrder:
             for c in d.ColOrder:
                 if d[r][c] > d[c][r]:
                     goal = d[r][c]
                 else:
                     goal = d[c][r]
                 self.assertEqual(n[r][c],goal)
                 self.assertEqual(n[c][r],goal)