Пример #1
0
 def test_get_simple_contrapunctus_duration_set(self):
     """
     Ensures that the duration indication is correctly set.
     """
     raw = [5, 7, 6, 5, 8, 7, 9, 8, 7, 6, 5]
     result = get_simple_contrapunctus(raw, 4)
     expected = "d' 4 f' e' d' g' f' a' g' f' e' d' 1"
     self.assertEqual(expected, result)
     # do it again with a different duration
     result = get_simple_contrapunctus(raw, 2)
     expected = "d' 2 f' e' d' g' f' a' g' f' e' d' 1"
     self.assertEqual(expected, result)
     # do it again with a semibreve duration (so final not need not be set).
     result = get_simple_contrapunctus(raw, 1)
     expected = "d' 1 f' e' d' g' f' a' g' f' e' d'"
     self.assertEqual(expected, result)
Пример #2
0
 def test_get_simple_contrapunctus_duration_set(self):
     """
     Ensures that the duration indication is correctly set.
     """
     raw = [5, 7, 6, 5, 8, 7, 9, 8, 7, 6, 5]
     result = get_simple_contrapunctus(raw, 4)
     expected = "d' 4 f' e' d' g' f' a' g' f' e' d' 1"
     self.assertEqual(expected, result)
     # do it again with a different duration
     result = get_simple_contrapunctus(raw, 2)
     expected = "d' 2 f' e' d' g' f' a' g' f' e' d' 1"
     self.assertEqual(expected, result)
     # do it again with a semibreve duration (so final not need not be set).
     result = get_simple_contrapunctus(raw, 1)
     expected = "d' 1 f' e' d' g' f' a' g' f' e' d'"
     self.assertEqual(expected, result)
Пример #3
0
    def test_get_simple_contrapunctus_rising_final_cadence(self):
        """
        Ensures that the final two notes are only a semitone apart if the
        melody is rising.
        """
        # check for if the diatonic notes are a tone apart
        raw = [5, 7, 6, 5, 8, 7, 9, 8, 7, 4, 5]
        result = get_simple_contrapunctus(raw, 4)
        expected = "d' 4 f' e' d' g' f' a' g' f' cis' d' 1"
        self.assertEqual(expected, result)

        # and again if the diatonic notes are only a semitone apart
        raw = [5, 7, 6, 5, 8, 7, 9, 8, 7, 6, 7]
        result = get_simple_contrapunctus(raw, 4)
        expected = "d' 4 f' e' d' g' f' a' g' f' e' f' 1"
        self.assertEqual(expected, result)
Пример #4
0
    def test_get_simple_contrapunctus_rising_final_cadence(self):
        """
        Ensures that the final two notes are only a semitone apart if the
        melody is rising.
        """
        # check for if the diatonic notes are a tone apart
        raw = [5, 7, 6, 5, 8, 7, 9, 8, 7, 4, 5]
        result = get_simple_contrapunctus(raw, 4)
        expected = "d' 4 f' e' d' g' f' a' g' f' cis' d' 1"
        self.assertEqual(expected, result)

        # and again if the diatonic notes are only a semitone apart
        raw = [5, 7, 6, 5, 8, 7, 9, 8, 7, 6, 7]
        result = get_simple_contrapunctus(raw, 4)
        expected = "d' 4 f' e' d' g' f' a' g' f' e' f' 1"
        self.assertEqual(expected, result)
Пример #5
0
 def test_good_get_simple_contrapunctus(self):
     """
     The known good case.
     """
     raw = [5, 7, 6, 5, 8, 7, 9, 8, 7, 6, 5]
     result = get_simple_contrapunctus(raw, 4)
     expected = "d' 4 f' e' d' g' f' a' g' f' e' d' 1"
     self.assertEqual(expected, result)
Пример #6
0
 def test_good_get_simple_contrapunctus(self):
     """
     The known good case.
     """
     raw = [5, 7, 6, 5, 8, 7, 9, 8, 7, 6, 5]
     result = get_simple_contrapunctus(raw, 4)
     expected = "d' 4 f' e' d' g' f' a' g' f' e' d' 1"
     self.assertEqual(expected, result)
Пример #7
0
 def test_empty_get_simple_contrapunctus(self):
     """
     An empty list should return an empty string.
     """
     result = get_simple_contrapunctus([], 1)
     self.assertEqual('', result)
Пример #8
0
 def test_empty_get_simple_contrapunctus(self):
     """
     An empty list should return an empty string.
     """
     result = get_simple_contrapunctus([], 1)
     self.assertEqual('', result)