예제 #1
0
    def test_exceptions(self):
        too_low = chant.Note('E3')
        self.assertRaises(Exception,
                          lambda: chant.pitchToVolpiano(too_low.pitch))

        too_high = chant.Note('E6')
        self.assertRaises(Exception,
                          lambda: chant.pitchToVolpiano(too_high.pitch))
예제 #2
0
 def test_pitchConversion(self):
     lowest = chant.Note('F3')
     highest = chant.Note('D6')
     volpianoNotes = '89abcdefghjklmnopqrs'
     i = 0
     for octave in [3, 4, 5, 6]:
         for noteName in 'CDEFGAB':
             n = chant.Note(f'{noteName}{octave}')
             if lowest <= n and n <= highest:
                 volpiano = chant.pitchToVolpiano(n.pitch)
                 self.assertEqual(volpiano, volpianoNotes[i])
                 self.assertEqual(n.volpiano, volpianoNotes[i])
                 i += 1
예제 #3
0
 def test_neume(self):
     n = chant.Neume()
     c = chant.Note('C4')
     d = chant.Note('D4')
     n.append([c, d])
     targetObj = {
         'type':
         'neume',
         'elements': [{
             'pitch': 'C4',
             'type': 'note'
         }, {
             'pitch': 'D4',
             'type': 'note'
         }]
     }
     self.assertDictEqual(n.toObject(), targetObj)
예제 #4
0
 def test_noteWithEditorialInfo(self):
     n = chant.Note('D-4')
     n.editorial.foo = 'bar'
     targetObj = {
         'pitch': 'D-4',
         'type': 'note',
         'editorial': {
             'foo': 'bar'
         }
     }
     self.assertDictEqual(n.toObject(), targetObj)
예제 #5
0
 def test_note(self):
     n = chant.Note()
     obj = {
         'type': 'note',
         'pitch': 'D-4',
         'editorial': {
             'foo': 'bar'
         },
         'notehead': 'x'
     }
     n.fromObject(obj)
     self.assertEqual(n.pitch.nameWithOctave, 'D-4')
     self.assertEqual(n.notehead, 'x')
     self.assertEqual(n.editorial.foo, 'bar')
예제 #6
0
 def test_liquescence(self):
     n = chant.Note('C4')
     n.editorial.liquescence = True
     self.assertEqual(n.volpiano, 'C')
예제 #7
0
 def test_note(self):
     n = chant.Note('D-4')
     targetObj = {'pitch': 'D-4', 'type': 'note'}
     self.assertDictEqual(n.toObject(), targetObj)