本文整理汇总了Python中mutagen.asf.ASF.pprint方法的典型用法代码示例。如果您正苦于以下问题:Python ASF.pprint方法的具体用法?Python ASF.pprint怎么用?Python ASF.pprint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mutagen.asf.ASF
的用法示例。
在下文中一共展示了ASF.pprint方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TASFIssue29
# 需要导入模块: from mutagen.asf import ASF [as 别名]
# 或者: from mutagen.asf.ASF import pprint [as 别名]
class TASFIssue29(TestCase):
original = os.path.join("tests", "data", "issue_29.wma")
def setUp(self):
fd, self.filename = mkstemp(suffix='wma')
os.close(fd)
shutil.copy(self.original, self.filename)
self.audio = ASF(self.filename)
def tearDown(self):
os.unlink(self.filename)
def test_pprint(self):
self.audio.pprint()
def test_issue_29_description(self):
self.audio["Description"] = "Hello"
self.audio.save()
audio = ASF(self.filename)
self.failUnless("Description" in audio)
self.failUnlessEqual(audio["Description"], ["Hello"])
del(audio["Description"])
self.failIf("Description" in audio)
audio.save()
audio = ASF(self.filename)
self.failIf("Description" in audio)
示例2: TASFIssue29
# 需要导入模块: from mutagen.asf import ASF [as 别名]
# 或者: from mutagen.asf.ASF import pprint [as 别名]
class TASFIssue29(TestCase):
original = os.path.join(DATA_DIR, "issue_29.wma")
def setUp(self):
self.filename = get_temp_copy(self.original)
self.audio = ASF(self.filename)
def tearDown(self):
os.unlink(self.filename)
def test_pprint(self):
self.audio.pprint()
def test_issue_29_description(self):
self.audio["Description"] = "Hello"
self.audio.save()
audio = ASF(self.filename)
self.failUnless("Description" in audio)
self.failUnlessEqual(audio["Description"], ["Hello"])
del(audio["Description"])
self.failIf("Description" in audio)
audio.save()
audio = ASF(self.filename)
self.failIf("Description" in audio)
示例3: TASF
# 需要导入模块: from mutagen.asf import ASF [as 别名]
# 或者: from mutagen.asf.ASF import pprint [as 别名]
class TASF(TestCase):
def setUp(self):
fd, self.filename = mkstemp(suffix='wma')
os.close(fd)
shutil.copy(self.original, self.filename)
self.audio = ASF(self.filename)
def tearDown(self):
os.unlink(self.filename)
def test_pprint(self):
self.failUnless(self.audio.pprint())
def set_key(self, key, value, result=None, expected=True):
self.audio[key] = value
self.audio.save()
self.audio = ASF(self.audio.filename)
self.failUnless(key in self.audio)
self.failUnless(key in self.audio.tags)
self.failUnless(key in self.audio.tags.keys())
self.failUnless(key in self.audio.tags.as_dict().keys())
newvalue = self.audio[key]
if isinstance(newvalue, list):
for a, b in zip(sorted(newvalue), sorted(result or value)):
self.failUnlessEqual(a, b)
else:
self.failUnlessEqual(self.audio[key], result or value)
def test_contains(self):
self.failUnlessEqual("notatag" in self.audio.tags, False)
def test_inval_type(self):
self.failUnlessRaises(ValueError, ASFValue, "", 4242)
def test_repr(self):
repr(ASFValue(u"foo", UNICODE, stream=1, language=2))
def test_auto_guuid(self):
value = ASFValue(b'\x9eZl}\x89\xa2\xb5D\xb8\xa30\xfe', GUID)
self.set_key(u"WM/WMCollectionGroupID", value, [value])
def test_auto_unicode(self):
self.set_key(u"WM/AlbumTitle", u"foo",
[ASFValue(u"foo", UNICODE)])
def test_auto_unicode_list(self):
self.set_key(u"WM/AlbumTitle", [u"foo", u"bar"],
[ASFValue(u"foo", UNICODE), ASFValue(u"bar", UNICODE)])
def test_word(self):
self.set_key(u"WM/Track", ASFValue(24, WORD), [ASFValue(24, WORD)])
def test_auto_word(self):
self.set_key(u"WM/Track", 12,
[ASFValue(12, DWORD)])
def test_auto_word_list(self):
self.set_key(u"WM/Track", [12, 13],
[ASFValue(12, WORD), ASFValue(13, WORD)])
def test_auto_dword(self):
self.set_key(u"WM/Track", 12,
[ASFValue(12, DWORD)])
def test_auto_dword_list(self):
self.set_key(u"WM/Track", [12, 13],
[ASFValue(12, DWORD), ASFValue(13, DWORD)])
def test_auto_qword(self):
self.set_key(u"WM/Track", 12,
[ASFValue(12, QWORD)])
def test_auto_qword_list(self):
self.set_key(u"WM/Track", [12, 13],
[ASFValue(12, QWORD), ASFValue(13, QWORD)])
def test_auto_bool(self):
self.set_key(u"IsVBR", True,
[ASFValue(True, BOOL)])
def test_auto_bool_list(self):
self.set_key(u"IsVBR", [True, False],
[ASFValue(True, BOOL), ASFValue(False, BOOL)])
def test_basic_tags(self):
self.set_key("Title", "Wheeee", ["Wheeee"])
self.set_key("Author", "Whoooo", ["Whoooo"])
self.set_key("Copyright", "Whaaaa", ["Whaaaa"])
self.set_key("Description", "Wii", ["Wii"])
self.set_key("Rating", "5", ["5"])
def test_stream(self):
self.audio["QL/OneHasStream"] = [
ASFValue("Whee", UNICODE, stream=2),
ASFValue("Whee", UNICODE),
]
self.audio["QL/AllHaveStream"] = [
ASFValue("Whee", UNICODE, stream=1),
ASFValue("Whee", UNICODE, stream=2),
#.........这里部分代码省略.........
示例4: TASF
# 需要导入模块: from mutagen.asf import ASF [as 别名]
# 或者: from mutagen.asf.ASF import pprint [as 别名]
class TASF(TestCase):
def setUp(self):
fd, self.filename = mkstemp(suffix='wma')
os.close(fd)
shutil.copy(self.original, self.filename)
self.audio = ASF(self.filename)
def tearDown(self):
os.unlink(self.filename)
def test_pprint(self):
self.failUnless(self.audio.pprint())
def set_key(self, key, value, result=None):
self.audio[key] = value
self.failUnless(key in self.audio)
self.audio.save()
self.audio = ASF(self.audio.filename)
self.failUnless(key in self.audio)
newvalue = self.audio[key]
if isinstance(newvalue, list):
for a, b in zip(sorted(newvalue), sorted(result or value)):
self.failUnlessEqual(a, b)
else:
self.failUnlessEqual(audio[key], result or value)
def test_auto_unicode(self):
self.set_key(u"WM/AlbumTitle", u"foo",
[ASFValue(u"foo", UNICODE)])
def test_auto_unicode_list(self):
self.set_key(u"WM/AlbumTitle", [u"foo", u"bar"],
[ASFValue(u"foo", UNICODE), ASFValue(u"bar", UNICODE)])
def test_auto_word(self):
self.set_key(u"WM/Track", 12,
[ASFValue(12, DWORD)])
def test_auto_word_list(self):
self.set_key(u"WM/Track", [12, 13],
[ASFValue(12, WORD), ASFValue(13, WORD)])
def test_auto_dword(self):
self.set_key(u"WM/Track", 12,
[ASFValue(12, DWORD)])
def test_auto_dword_list(self):
self.set_key(u"WM/Track", [12, 13],
[ASFValue(12, DWORD), ASFValue(13, DWORD)])
def test_auto_qword(self):
self.set_key(u"WM/Track", 12L,
[ASFValue(12, QWORD)])
def test_auto_qword_list(self):
self.set_key(u"WM/Track", [12L, 13L],
[ASFValue(12, QWORD), ASFValue(13, QWORD)])
def test_auto_bool(self):
self.set_key(u"IsVBR", True,
[ASFValue(True, BOOL)])
def test_auto_bool_list(self):
self.set_key(u"IsVBR", [True, False],
[ASFValue(True, BOOL), ASFValue(False, BOOL)])
def test_basic_tags(self):
self.set_key("Title", "Wheeee", ["Wheeee"])
self.set_key("Author", "Whoooo", ["Whoooo"])
self.set_key("Copyright", "Whaaaa", ["Whaaaa"])
self.set_key("Description", "Wii", ["Wii"])
self.set_key("Rating", "5", ["5"])
def test_stream(self):
self.audio["QL/OneHasStream"] = [
ASFValue("Whee", UNICODE, stream=2),
ASFValue("Whee", UNICODE),
]
self.audio["QL/AllHaveStream"] = [
ASFValue("Whee", UNICODE, stream=1),
ASFValue("Whee", UNICODE, stream=2),
]
self.audio["QL/NoStream"] = ASFValue("Whee", UNICODE)
self.audio.save()
self.audio = ASF(self.audio.filename)
self.failUnlessEqual(self.audio["QL/NoStream"][0].stream, None)
self.failUnlessEqual(self.audio["QL/OneHasStream"][0].stream, 2)
self.failUnlessEqual(self.audio["QL/OneHasStream"][1].stream, None)
self.failUnlessEqual(self.audio["QL/AllHaveStream"][0].stream, 1)
self.failUnlessEqual(self.audio["QL/AllHaveStream"][1].stream, 2)
def test_language(self):
self.audio["QL/OneHasLang"] = [
ASFValue("Whee", UNICODE, language=2),
ASFValue("Whee", UNICODE),
]
self.audio["QL/AllHaveLang"] = [
ASFValue("Whee", UNICODE, language=1),
ASFValue("Whee", UNICODE, language=2),
#.........这里部分代码省略.........