本文整理汇总了Python中tests.path_to_data_dir函数的典型用法代码示例。如果您正苦于以下问题:Python path_to_data_dir函数的具体用法?Python path_to_data_dir怎么用?Python path_to_data_dir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了path_to_data_dir函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_log_file_that_gst_thinks_is_mpeg_1_is_ignored
def test_log_file_that_gst_thinks_is_mpeg_1_is_ignored(self):
self.scan([path_to_data_dir('scanner/example.log')])
self.check_if_missing_plugin()
log = path_to_data_dir('scanner/example.log')
self.assertLess(self.result[log].duration, 100)
示例2: setUp
def setUp(self):
settings.LOCAL_PLAYLIST_PATH = tempfile.mkdtemp()
settings.LOCAL_TAG_CACHE_FILE = path_to_data_dir('library_tag_cache')
settings.LOCAL_MUSIC_PATH = path_to_data_dir('')
self.backend = self.backend_class()
self.stored = self.backend.stored_playlists
示例3: test_duration_is_set
def test_duration_is_set(self):
self.scan(self.find('scanner/simple'))
self.assertEqual(
self.durations[path_to_data_dir('scanner/simple/song1.mp3')], 4680)
self.assertEqual(
self.durations[path_to_data_dir('scanner/simple/song1.ogg')], 4680)
示例4: test_simple_cache
def test_simple_cache(self):
tracks = parse_mpd_tag_cache(path_to_data_dir('simple_tag_cache'),
path_to_data_dir(''))
uri = path_to_uri(path_to_data_dir('song1.mp3'))
track = Track(name='trackname', artists=expected_artists, track_no=1,
album=expected_albums[0], length=4000, uri=uri)
self.assertEqual(set([track]), tracks)
示例5: test_duration_is_set
def test_duration_is_set(self):
self.scan(self.find('scanner/simple'))
ogg = path_to_data_dir('scanner/simple/song1.ogg')
mp3 = path_to_data_dir('scanner/simple/song1.mp3')
self.assertEqual(self.result[mp3].duration, 4680)
self.assertEqual(self.result[ogg].duration, 4680)
示例6: test_albumartist_tag_cache
def test_albumartist_tag_cache(self):
tracks = parse_mpd_tag_cache(path_to_data_dir("albumartist_tag_cache"), path_to_data_dir(""))
uri = path_to_uri(path_to_data_dir("song1.mp3"))
artist = Artist(name="albumartistname")
album = expected_albums[0].copy(artists=[artist])
track = Track(name="trackname", artists=expected_artists, track_no=1, album=album, length=4000, uri=uri)
self.assertEqual(track, list(tracks)[0])
示例7: test_simple_cache
def test_simple_cache(self):
tracks = parse_mpd_tag_cache(
path_to_data_dir('simple_tag_cache'), path_to_data_dir(''))
track = Track(
uri='local:track:song1.mp3', name='trackname',
artists=expected_artists, track_no=1, album=expected_albums[0],
date='2006', length=4000, last_modified=1272319626)
self.assertEqual(set([track]), tracks)
示例8: test_find_exact_uri
def test_find_exact_uri(self):
track_1_uri = 'file://' + path_to_data_dir('uri1')
result = self.library.find_exact(uri=track_1_uri)
self.assertEqual(list(result[0].tracks), self.tracks[:1])
track_2_uri = 'file://' + path_to_data_dir('uri2')
result = self.library.find_exact(uri=track_2_uri)
self.assertEqual(list(result[0].tracks), self.tracks[1:2])
示例9: test_uri_is_set
def test_uri_is_set(self):
self.scan(self.find('scanner/simple'))
self.check(
'scanner/simple/song1.mp3', 'uri',
'file://%s' % path_to_data_dir('scanner/simple/song1.mp3'))
self.check(
'scanner/simple/song1.ogg', 'uri',
'file://%s' % path_to_data_dir('scanner/simple/song1.ogg'))
示例10: setUp
def setUp(self):
settings.LOCAL_PLAYLIST_PATH = tempfile.mkdtemp()
settings.LOCAL_TAG_CACHE_FILE = path_to_data_dir('library_tag_cache')
settings.LOCAL_MUSIC_PATH = path_to_data_dir('')
self.audio = mock.Mock(spec=audio.Audio)
self.backend = self.backend_class.start(audio=self.audio).proxy()
self.core = core.Core(backends=[self.backend])
示例11: test_unicode_cache
def test_unicode_cache(self):
tracks = parse_mpd_tag_cache(path_to_data_dir("utf8_tag_cache"), path_to_data_dir(""))
uri = path_to_uri(path_to_data_dir("song1.mp3"))
artists = [Artist(name=u"æøå")]
album = Album(name=u"æøå", artists=artists)
track = Track(uri=uri, name=u"æøå", artists=artists, album=album, length=4000)
self.assertEqual(track, list(tracks)[0])
示例12: test_albumartist_tag_cache
def test_albumartist_tag_cache(self):
tracks = parse_mpd_tag_cache(
path_to_data_dir('albumartist_tag_cache'), path_to_data_dir(''))
artist = Artist(name='albumartistname')
album = expected_albums[0].copy(artists=[artist])
track = Track(
uri='local:track:song1.mp3', name='trackname',
artists=expected_artists, track_no=1, album=album, date='2006',
length=4000, last_modified=1272319626)
self.assertEqual(track, list(tracks)[0])
示例13: test_albumartist_tag_cache
def test_albumartist_tag_cache(self):
tracks = parse_mpd_tag_cache(
path_to_data_dir('albumartist_tag_cache'), path_to_data_dir(''))
uri = path_to_uri(path_to_data_dir('song1.mp3'))
artist = Artist(name='albumartistname')
album = expected_albums[0].copy(artists=[artist])
track = Track(
uri=uri, name='trackname', artists=expected_artists, track_no=1,
album=album, date='2006', length=4000)
self.assertEqual(track, list(tracks)[0])
示例14: test_unicode_cache
def test_unicode_cache(self):
tracks = parse_mpd_tag_cache(
path_to_data_dir('utf8_tag_cache'), path_to_data_dir(''))
artists = [Artist(name='æøå')]
album = Album(name='æøå', artists=artists)
track = Track(
uri='local:track:song1.mp3', name='æøå', artists=artists,
composers=artists, performers=artists, genre='æøå',
album=album, length=4000, last_modified=1272319626,
comment='æøå&^`ൂ㔶')
self.assertEqual(track, list(tracks)[0])
示例15: test_musicbrainz_tagcache
def test_musicbrainz_tagcache(self):
tracks = parse_mpd_tag_cache(path_to_data_dir('musicbrainz_tag_cache'),
path_to_data_dir(''))
artist = list(expected_tracks[0].artists)[0].copy(
musicbrainz_id='7364dea6-ca9a-48e3-be01-b44ad0d19897')
albumartist = list(expected_tracks[0].artists)[0].copy(
name='albumartistname',
musicbrainz_id='7364dea6-ca9a-48e3-be01-b44ad0d19897')
album = expected_tracks[0].album.copy(artists=[albumartist],
musicbrainz_id='cb5f1603-d314-4c9c-91e5-e295cfb125d2')
track = expected_tracks[0].copy(artists=[artist], album=album,
musicbrainz_id='90488461-8c1f-4a4e-826b-4c6dc70801f0')
self.assertEqual(track, list(tracks)[0])