class TVgmFile(TestCase): def setUp(self): self.song = VgmFile(get_data_path('test.vgm')) def test_length(self): self.failUnlessAlmostEqual(2.81, self.song("~#length", 0), 1) def test_reload(self): self.song["title"] = "foobar" self.song.reload() self.failUnlessEqual(self.song("title"), "foobar") def test_write(self): self.song.write() def test_can_change(self): self.failUnlessEqual(self.song.can_change(), ["title"]) self.failUnless(self.song.can_change("title")) self.failIf(self.song.can_change("album")) def test_invalid(self): path = get_data_path('empty.xm') self.failUnlessRaises(Exception, VgmFile, path) def test_format_codec(self): self.assertEqual(self.song("~format"), "VGM") self.assertEqual(self.song("~codec"), "VGM") self.assertEqual(self.song("~encoding"), "")
class TVgmFile(TestCase): def setUp(self): self.song = VgmFile(get_data_path('test.vgm')) def test_length(self): self.failUnlessAlmostEqual(2.81, self.song("~#length", 0), 1) def test_reload(self): self.song["title"] = "foobar" self.song.reload() self.failUnlessEqual(self.song("title"), "Chaos Emerald") def test_gd3_tags(self): expected_tags = { "title": "Chaos Emerald", "album": "Sonic the Hedgehog\nソニック・ザ・ヘッジホッグ", "console": "Sega Mega Drive\nセガメガドライブ", "artist": "Masato Nakamura\n中村正人", "date": "1991" } for k, v in expected_tags.items(): self.failUnlessEqual(self.song[k], v) def test_write(self): self.song.write() def test_can_change(self): self.failUnlessEqual(self.song.can_change(), ["title"]) self.failUnless(self.song.can_change("title")) self.failIf(self.song.can_change("album")) def test_invalid(self): path = get_data_path('empty.xm') self.failUnlessRaises(Exception, VgmFile, path) def test_format_codec(self): self.assertEqual(self.song("~format"), "VGM") self.assertEqual(self.song("~codec"), "VGM") self.assertEqual(self.song("~encoding"), "")
class TVgmFile(TestCase): def setUp(self): self.song = VgmFile(os.path.join(DATA_DIR, 'test.vgm')) def test_length(self): self.failUnlessAlmostEqual(2.81, self.song("~#length", 0), 1) def test_reload(self): self.song["title"] = "foobar" self.song.reload() self.failUnlessEqual(self.song("title"), "foobar") def test_write(self): self.song.write() def test_can_change(self): self.failUnlessEqual(self.song.can_change(), ["title"]) self.failUnless(self.song.can_change("title")) self.failIf(self.song.can_change("album")) def test_invalid(self): path = os.path.join(DATA_DIR, 'empty.xm') self.failUnlessRaises(Exception, VgmFile, path)