Ejemplo n.º 1
0
class SetAnalysis(unittest.TestCase):
    def setUp(self):
        self.amaj = PcSet('9B12468')
        self.empty = PcSet([])

    # ivec

    def test_ivec_ait1(self):
        ait1 = PcSet('0146')
        self.assertEqual(ait1.ivec(), [1] * 6)

    def test_ivec_ait2(self):
        ait2 = PcSet('0137')
        self.assertEqual(ait2.ivec(), [1] * 6)

    def test_ivec_empty(self):
        self.assertEqual(self.empty.ivec(), [0] * 6)

    # cvec

    def test_cvec(self):
        """
        Tests the fundamental definition of cvec: that a given value at
        index n will be the number of common tones for the operation TnI.
        """
        cvec = self.amaj.cvec()
        for n in range(12):
            original = set(self.amaj)
            transformed = set(self.amaj.invert().transpose(n))
            common_tones = len(original & transformed)
            self.assertEqual(common_tones, cvec[n])

    def test_cvec_empty(self):
        self.assertEqual(self.empty.cvec(), [0] * 12)
Ejemplo n.º 2
0
 def test_ivec_ait2(self):
     ait2 = PcSet('0137')
     self.assertEqual(ait2.ivec(), [1] * 6)
Ejemplo n.º 3
0
 def test_ivec_ait1(self):
     ait1 = PcSet('0146')
     self.assertEqual(ait1.ivec(), [1] * 6)