本文整理汇总了Python中tests.get_data_path函数的典型用法代码示例。如果您正苦于以下问题:Python get_data_path函数的具体用法?Python get_data_path怎么用?Python get_data_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_data_path函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: setUp
def setUp(self):
self.f = get_temp_copy(get_data_path('test.wma'))
self.song = WMAFile(self.f)
self.f2 = get_temp_copy(get_data_path('test-2.wma'))
self.song2 = WMAFile(self.f2)
self.f3 = get_temp_copy(get_data_path('test.asf'))
self.song3 = WMAFile(self.f3)
开发者ID:ZDBioHazard,项目名称:quodlibet,代码行数:9,代码来源:test_formats_wma.py
示例2: setUp
def setUp(self):
config.init()
self.f = get_temp_copy(get_data_path('silence-44-s.ogg'))
self.f2 = get_temp_copy(get_data_path('silence-44-s.mp3'))
self.s = MusicFile(self.f)
self.s2 = MusicFile(self.f2)
fd, self.f3 = mkstemp(".mp3")
os.write(fd, b"garbage")
os.close(fd)
开发者ID:LudoBike,项目名称:quodlibet,代码行数:11,代码来源:test_operon.py
示例3: test_music_file
def test_music_file(self):
path = get_data_path('silence-44-s.mp3')
self.assertTrue(formats.MusicFile(path))
# non existing
with capture_output() as (stdout, stderr):
song = formats.MusicFile(get_data_path("nope.mp3"))
self.assertFalse(song)
self.assertTrue(stderr.getvalue())
# unknown extension
with capture_output() as (stdout, stderr):
song = formats.MusicFile(get_data_path("nope.xxx"))
self.assertFalse(song)
self.assertFalse(stderr.getvalue())
开发者ID:urielz,项目名称:quodlibet,代码行数:15,代码来源:test_formats___init__.py
示例4: test_decode_all
def test_decode_all(self):
"""Decode all kinds of formats using Gstreamer, to check if
they all work and to notify us if a plugin is missing on
platforms where we control the packaging.
"""
files = [
"coverart.wv",
"empty.aac",
"empty.flac",
"empty.ogg",
"empty.opus",
"silence-44-s.mpc",
"silence-44-s.sv8.mpc",
"silence-44-s.tta",
"test.mid",
"test.spc",
"test.vgm",
"test.wma",
"silence-44-s.spx",
"empty.xm",
]
for file_ in files:
path = get_data_path(file_)
song = MusicFile(path)
if song is not None:
self._check(song)
开发者ID:urielz,项目名称:quodlibet,代码行数:28,代码来源:test_player_gst.py
示例5: test_rename_to_existing
def test_rename_to_existing(self):
quux.rename(quux("~basename"))
if os.name != "nt":
self.failUnlessRaises(
ValueError, quux.rename, fsnative(u"/dev/null"))
self.failUnlessRaises(ValueError, quux.rename,
get_data_path("silence-44-s.ogg"))
开发者ID:ZDBioHazard,项目名称:quodlibet,代码行数:7,代码来源:test_formats__audio.py
示例6: setUp
def setUp(s):
s.wide = GdkPixbuf.Pixbuf.new(
GdkPixbuf.Colorspace.RGB, True, 8, 150, 10)
s.high = GdkPixbuf.Pixbuf.new(
GdkPixbuf.Colorspace.RGB, True, 8, 10, 100)
s.small = GdkPixbuf.Pixbuf.new(
GdkPixbuf.Colorspace.RGB, True, 8, 10, 20)
s.filename = get_data_path("test.png")
开发者ID:LudoBike,项目名称:quodlibet,代码行数:8,代码来源:test_util_thumbnails.py
示例7: test_feed
def test_feed(self):
fn = get_data_path('valid_feed.xml')
feed = Feed(pathlib.Path(fn).as_uri())
result = feed.parse()
self.failUnless(result)
self.failUnlessEqual(len(feed), 2)
self.failUnlessEqual(feed[0]('title'),
'Full Episode: Tuesday, November 28, 2017')
开发者ID:LudoBike,项目名称:quodlibet,代码行数:8,代码来源:test_browsers_audiofeeds.py
示例8: test_get_link_target_unicode
def test_get_link_target_unicode(self):
path = get_data_path("test2.lnk")
d = windows.get_link_target(path)
self.assertTrue(isinstance(d, unicode))
if is_wine():
# wine doesn't support unicode paths here..
self.assertEqual(os.path.basename(d), u"\xe1??.txt")
else:
self.assertEqual(os.path.basename(d), u"\xe1\U00016826.txt")
开发者ID:urielz,项目名称:quodlibet,代码行数:9,代码来源:test_windows.py
示例9: test_ma_file_old
def test_ma_file_old():
s = MonkeysAudioFile(get_data_path('mac-396.ape'))
assert s("~format") == "Monkey's Audio"
assert s("~codec") == "Monkey's Audio"
assert s("~encoding") == ""
assert s("~#channels") == 2
assert s("~#samplerate") == 44100
# depends on the mutagen version
assert s("~#bitdepth", 0) in (0, 16)
开发者ID:LudoBike,项目名称:quodlibet,代码行数:10,代码来源:test_formats_apev2.py
示例10: test_parse_onesong
def test_parse_onesong(self):
with temp_filename() as name:
with open(name, "wb") as af:
target = self.prefix
target += fsn2bytes(get_data_path("silence-44-s.ogg"), "utf-8")
af.write(target)
with open(name, "rb") as f:
pl = self.Parse(f, name)
self.failUnlessEqual(len(pl), 1)
self.failUnlessEqual(pl[0]("title"), "Silence")
pl.delete()
开发者ID:LudoBike,项目名称:quodlibet,代码行数:11,代码来源:test_browsers_playlists.py
示例11: test_parse_onesong_uri
def test_parse_onesong_uri(self):
target = get_data_path("silence-44-s.ogg")
target = fsn2uri(target).encode("ascii")
target = self.prefix + target
with temp_filename() as name:
with open(name, "wb") as f:
f.write(target)
with open(name, "rb") as f:
pl = self.Parse(f, name)
self.failUnlessEqual(len(pl), 1)
self.failUnlessEqual(pl[0]("title"), "Silence")
pl.delete()
开发者ID:LudoBike,项目名称:quodlibet,代码行数:12,代码来源:test_browsers_playlists.py
示例12: test_parse_onesong
def test_parse_onesong(self):
h, name = mkstemp()
os.close(h)
with open(name, "wb") as f:
target = self.prefix
target += fsn2glib(get_data_path("silence-44-s.ogg"))
f.write(target)
list = self.Parse(name)
os.unlink(name)
self.failUnlessEqual(len(list), 1)
self.failUnlessEqual(list[0]("title"), "Silence")
list.delete()
开发者ID:urielz,项目名称:quodlibet,代码行数:12,代码来源:test_browsers_playlists.py
示例13: test_parse_onesong_uri
def test_parse_onesong_uri(self):
h, name = mkstemp()
os.close(h)
target = get_data_path("silence-44-s.ogg")
target = fsn2uri(target)
target = self.prefix + target
with open(name, "w") as f:
f.write(target)
list = self.Parse(name)
os.unlink(name)
self.failUnlessEqual(len(list), 1)
self.failUnlessEqual(list[0]("title"), "Silence")
list.delete()
开发者ID:urielz,项目名称:quodlibet,代码行数:13,代码来源:test_browsers_playlists.py
示例14: setUp
def setUp(self):
config.init()
self.main = mkdtemp()
self.dir1 = mkdtemp(dir=self.main)
self.dir2 = mkdtemp(dir=self.main)
h, self.cover1 = mkstemp(".png", dir=self.main)
os.close(h)
pb = GdkPixbuf.Pixbuf.new(GdkPixbuf.Colorspace.RGB, True, 8, 10, 10)
pb.savev(self.cover1, "png", [], [])
h, self.cover2 = mkstemp(".png", dir=self.main)
os.close(h)
pb = GdkPixbuf.Pixbuf.new(GdkPixbuf.Colorspace.RGB, True, 8, 20, 20)
pb.savev(self.cover2, "png", [], [])
self.file1 = get_temp_copy(get_data_path('silence-44-s.mp3'))
self.file2 = get_temp_copy(get_data_path('silence-44-s.mp3'))
self.manager = CoverManager()
开发者ID:LudoBike,项目名称:quodlibet,代码行数:22,代码来源:test_plugins_cover.py
示例15: test_analyze_silence
def test_analyze_silence(self):
song = MusicFile(get_data_path("silence-44-s.ogg"))
self.failIf(song("~replaygain_track_gain"))
self._analyse_song(song)
self.failUnlessAlmostEqual(song("~#replaygain_track_peak"), 0.0, msg="Track peak should be 0.0")
track_gain = song("~#replaygain_track_gain")
self.failUnless(track_gain, msg="No Track Gain added")
# For one-song album, track == album
self.failUnlessEqual(track_gain, song("~#replaygain_album_gain"))
开发者ID:urielz,项目名称:quodlibet,代码行数:13,代码来源:test_replaygain.py
示例16: test_analyze_sinewave
def test_analyze_sinewave(self):
song = MusicFile(get_data_path("sine-110hz.flac"))
self.failUnlessEqual(song("~#length"), 2)
self.failIf(song("~replaygain_track_gain"))
self._analyse_song(song)
self.failUnlessAlmostEqual(song("~#replaygain_track_peak"), 1.0, msg="Track peak should be 1.0")
track_gain = song("~#replaygain_track_gain")
self.failUnless(track_gain, msg="No Track Gain added")
self.failUnless(re.match(r"\-[0-9]\.[0-9]{1,2}", str(track_gain)))
# For one-song album, track == album
self.failUnlessEqual(track_gain, song("~#replaygain_album_gain"))
开发者ID:urielz,项目名称:quodlibet,代码行数:15,代码来源:test_replaygain.py
示例17: test_analyze_silence
def test_analyze_silence(self):
pipeline = self.mod.analyze.FingerPrintPipeline()
song = MusicFile(get_data_path("silence-44-s.ogg"))
done = []
def callback(self, *args):
done.extend(args)
pipeline.start(song, callback)
t = time.time()
while not done and time.time() - t < self.TIMEOUT:
Gtk.main_iteration_do(False)
self.assertTrue(done)
s, result, error = done
# silence doesn't produce a fingerprint
self.assertTrue(error)
self.assertFalse(result)
self.assertTrue(song is s)
开发者ID:LudoBike,项目名称:quodlibet,代码行数:17,代码来源:test_fingerprint.py
示例18: test_rename
def test_rename(self):
old_fn = quux("~basename")
new_fn = fsnative(u"anothersong.mp3")
dir = os.path.dirname(get_data_path(""))
self.failUnless(quux.exists())
quux.rename(new_fn)
self.failIf(os.path.exists(dir + old_fn),
"%s already exists" % (dir + old_fn))
self.failUnless(quux.exists())
quux.rename(old_fn)
self.failIf(os.path.exists(dir + new_fn))
self.failUnless(quux.exists())
# move out of parent dir and back
quux.rename(fsnative(u"/tmp/more_test_data"))
self.failIf(os.path.exists(dir + old_fn))
self.failUnless(quux.exists())
quux.rename(dir + old_fn)
self.failUnless(quux.exists())
开发者ID:ZDBioHazard,项目名称:quodlibet,代码行数:19,代码来源:test_formats__audio.py
示例19: test_analyze_pool
def test_analyze_pool(self):
pool = self.mod.analyze.FingerPrintPool()
song = MusicFile(get_data_path("silence-44-s.ogg"))
events = []
def handler(*args):
events.append(args)
pool.connect("fingerprint-started", handler, "start")
pool.connect("fingerprint-done", handler, "done")
pool.connect("fingerprint-error", handler, "error")
pool.push(song)
t = time.time()
while len(events) < 2 and time.time() - t < self.TIMEOUT:
Gtk.main_iteration_do(False)
self.assertEqual(len(events), 2)
self.assertEqual(events[0][-1], "start")
self.assertEqual(events[1][-1], "error")
开发者ID:LudoBike,项目名称:quodlibet,代码行数:21,代码来源:test_fingerprint.py
示例20: test_decode_all
def test_decode_all(self):
"""Decode all kinds of formats using Gstreamer, to check if
they all work and to notify us if a plugin is missing on
platforms where we control the packaging.
"""
files = [
"coverart.wv",
"empty.aac",
"empty.flac",
"empty.ogg",
"empty.opus",
"silence-44-s.mpc",
"silence-44-s.sv8.mpc",
"silence-44-s.tta",
# "test.mid",
"test.spc",
"test.vgm",
"test.wma",
"silence-44-s.spx",
"empty.xm",
"h264_aac.mp4",
"h265_aac.mp4"
]
errors = []
for file_ in files:
path = get_data_path(file_)
song = MusicFile(path)
if song is not None:
error = self._check(song)
if error:
errors.append((song("~format"), error))
if errors:
raise Exception("Decoding failed %r" % errors)
开发者ID:LudoBike,项目名称:quodlibet,代码行数:36,代码来源:test_player_gst.py
注:本文中的tests.get_data_path函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论