Пример #1
0
    def test_beat_setting_instrument(self):
        """
        ビートに楽器を設定できること
        """
        import compose
        beat = compose.Beat()

        # Guitar 1と言う名前の楽器を追加できること
        beat.instrument.add(name="Guitar 1", itype="Guitar")
        self.assertTrue(beat.instrument.has("Guitar 1"))
        self.assertEqual(beat.instrument.get("Guitar 1").itype, "Guitar")

        # MyBaseと言う名前の楽器を追加できること
        beat.instrument.add(name="My Base", itype="Base")
        self.assertTrue(beat.instrument.has("My Base"))
        self.assertEqual(beat.instrument.get("My Base").itype, "Base")

        # FavoriteDrumと言う名前の楽器を追加できること
        beat.instrument.add(name="Favorite Drum", itype="Drum")
        self.assertTrue(beat.instrument.has("Favorite Drum"))
        self.assertEqual(section.instrument.get("Favorite Drum").itype, "Drum")

        # 3点測量
        self.assertFalse(beat.instrument.has("Voval melody"))
        with self.assertRaises(KeyError):
            self.assertFalse(beat.instrument.get("Voval melody"))
        self.assertEqual(beat.instrument.count, 3)
Пример #2
0
 def test_beat_setting_instrument_change(self):
     """
     ビートに設定されている楽器を別の楽器に切り替える
     """
     import compose
     beat = compose.Beat(template="My Test Template2")
     self.assertEqual(beat.instrument.get("Drums").itype, "Drum")
     beat.instrument.get("Drums").itype = "Guitar"
     self.assertEqual(beat.instrument.get("Drums").itype, "Guitar")
Пример #3
0
 def test_section_setting_beat(self):
     """
     Sectionにビートを設定できること
     """
     import compose
     section = compose.Section()
     self.assertIsInstance(section.beat, compose.Beat)
     beat_name = "ビートの名前"
     section.beat = compose.Beat(name=beat_name)
     self.assertEqual(section.beat.name, beat_name)
Пример #4
0
 def test_beat_setting_instrument_other(self):
     """
     ビートにテンプレートを選ぶと楽器が選択されている
     別パターン
     """
     import compose
     # My Test Template2と言うテンプレートには、1つのテンプレートを含める
     beat = compose.Beat(template="My Test Template2")
     self.assertEqual(len(beat.instruments), 1)
     self.assertTrue(beat.instrument.has("Drums"))
     self.assertTrue("Favorite Drum", beat.instruments)
Пример #5
0
 def test_beat_setting_instrument(self):
     """
     ビートにテンプレートを選ぶと楽器が選択されている
     """
     import compose
     # My Test Templateと言うテンプレートには、3つのテンプレートを含める
     beat = compose.Beat(template="My Test Template")
     self.assertTrue(beat.instrument.has("Guitar 1"))
     self.assertTrue(beat.instrument.has("My Base"))
     self.assertTrue(beat.instrument.has("Favorite Drum"))
     self.assertTrue("Guitar 1", beat.instruments)
     self.assertTrue("My Base", beat.instruments)
     self.assertTrue("Favorite Drume", beat.instruments)
     self.assertEqual(beat.instrument.count, 3)