本文整理汇总了Python中quodlibet.formats.AudioFile.exists方法的典型用法代码示例。如果您正苦于以下问题:Python AudioFile.exists方法的具体用法?Python AudioFile.exists怎么用?Python AudioFile.exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类quodlibet.formats.AudioFile
的用法示例。
在下文中一共展示了AudioFile.exists方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TAudioFile
# 需要导入模块: from quodlibet.formats import AudioFile [as 别名]
# 或者: from quodlibet.formats.AudioFile import exists [as 别名]
#.........这里部分代码省略.........
self.failUnlessEqual(bar_2_1.list_separate("~artist~album"),
[('Foo', 'Foosort'),
('I have two artists', 'I have two artists'),
('Bar', 'Bar')])
self.failUnlessEqual(bar_2_1.list_separate("~artist~~#track"),
[('Foo', 'Foosort'),
('I have two artists', 'I have two artists'),
('1', '1')])
def test_list_list_separate_types(self):
res = bar_2_1.list_separate("~~#track~artist~~filename")
self.assertEqual(res, [(u'1', u'1'), (u'Foo', u'Foosort'),
(u'I have two artists', u'I have two artists'),
(u'does not/exist', u'does not/exist')])
def test_list_numeric(self):
self.assertEqual(bar_1_2.list('~#bitrate'), [128])
def test_comma(self):
for key in bar_1_1.realkeys():
self.failUnlessEqual(bar_1_1.comma(key), bar_1_1(key))
self.failUnless(", " in bar_2_1.comma("artist"))
def test_comma_filename(self):
self.assertTrue(isinstance(bar_1_1.comma("~filename"), text_type))
def test_comma_mountpoint(self):
assert not bar_1_1("~mountpoint")
assert isinstance(bar_1_1.comma("~mountpoint"), text_type)
assert bar_1_1.comma("~mountpoint") == u""
def test_exist(self):
self.failIf(bar_2_1.exists())
self.failUnless(self.quux.exists())
def test_valid(self):
self.failIf(bar_2_1.valid())
quux = self.quux
quux["~#mtime"] = 0
self.failIf(quux.valid())
quux["~#mtime"] = os.path.getmtime(quux["~filename"])
self.failUnless(quux.valid())
os.utime(quux["~filename"], (quux["~#mtime"], quux["~#mtime"] - 1))
self.failIf(quux.valid())
quux["~#mtime"] = os.path.getmtime(quux["~filename"])
self.failUnless(quux.valid())
os.utime(quux["~filename"], (quux["~#mtime"], quux["~#mtime"] - 1))
quux.sanitize()
self.failUnless(quux.valid())
def test_can_change(self):
af = AudioFile()
self.failIf(af.can_change("~foobar"))
self.failIf(af.can_change("=foobar"))
self.failIf(af.can_change("foo=bar"))
self.failIf(af.can_change(""))
self.failUnless(af.can_change("foo bar"))
def test_is_writable(self):
self.assertTrue(self.quux.is_writable())
os.chmod(self.quux["~filename"], 0o444)
self.assertFalse(self.quux.is_writable())
os.chmod(self.quux["~filename"], 0o644)