def test_get_note_octave(self): parser = RtttlParser(self.SONG['rtttl']) result = parser.get_note_octave('4c#.7') expected_result = '7' self.assertTrue(result == expected_result)
def test_get_notes(self): parser = RtttlParser(self.SONG['rtttl']) result = parser.get_notes() expected_result = self.SONG['notes'] self.assertTrue(result == expected_result)
def test_get_note_elements(self): parser = RtttlParser(self.SONG['rtttl']) result = parser.get_note_elements('4c#.7') expected_result = ('4', 'c#', '.', '7') self.assertTrue(result == expected_result)
def test_interpret(self): parser = RtttlParser(self.SONG['rtttl']) result = parser.interpret() expected_result = self.SONG['interpretation'] self.assertTrue(result == expected_result)
def test_frequencies(self): self.assertTrue( isinstance(RtttlParser(self.SONG['rtttl']).FREQUENCIES, dict))
def __init__(self, rtttl): self.rtttl = rtttl self.interpretation = RtttlParser(rtttl).interpret() self.durations = self.get_durations() self.frequencies = self.get_frequencies()