• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python tests.path_to_data_dir函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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)
开发者ID:AddBassStudios,项目名称:mopidy,代码行数:7,代码来源:test_scan.py


示例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
开发者ID:Dvad,项目名称:mopidy,代码行数:7,代码来源:stored_playlists.py


示例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)
开发者ID:clarkjdj,项目名称:mopidy,代码行数:7,代码来源:test_scan.py


示例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)
开发者ID:Amli,项目名称:mopidy,代码行数:7,代码来源:translator_test.py


示例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)
开发者ID:FabrizioCongia,项目名称:mopidy,代码行数:7,代码来源:test_scan.py


示例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])
开发者ID:ruudud,项目名称:mopidy,代码行数:7,代码来源:translator_test.py


示例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)
开发者ID:abarisain,项目名称:mopidy,代码行数:8,代码来源:translator_test.py


示例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])
开发者ID:0xadam,项目名称:mopidy,代码行数:8,代码来源:library.py


示例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'))
开发者ID:NilsNoreyson,项目名称:mopidy,代码行数:8,代码来源:test_scan.py


示例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])
开发者ID:0xadam,项目名称:mopidy,代码行数:8,代码来源:playlists.py


示例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])
开发者ID:ruudud,项目名称:mopidy,代码行数:9,代码来源:translator_test.py


示例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])
开发者ID:abarisain,项目名称:mopidy,代码行数:10,代码来源:translator_test.py


示例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])
开发者ID:Halfnhav,项目名称:mopidy,代码行数:10,代码来源:translator_test.py


示例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])
开发者ID:abarisain,项目名称:mopidy,代码行数:13,代码来源:translator_test.py


示例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])
开发者ID:Amli,项目名称:mopidy,代码行数:14,代码来源:translator_test.py


示例16: test_refresh_missing_uri

    def test_refresh_missing_uri(self):
        # Verifies that https://github.com/mopidy/mopidy/issues/500
        # has been fixed.

        tmpdir = tempfile.mkdtemp()
        try:
            tmplib = os.path.join(tmpdir, 'library.json.gz')
            shutil.copy(path_to_data_dir('library.json.gz'), tmplib)

            config = {'local': self.config['local'].copy()}
            config['local']['data_dir'] = tmpdir
            backend = actor.LocalBackend(config=config, audio=None)

            # Sanity check that value is in the library
            result = backend.library.lookup(self.tracks[0].uri)
            self.assertEqual(result, self.tracks[0:1])

            # Clear and refresh.
            open(tmplib, 'w').close()
            backend.library.refresh()

            # Now it should be gone.
            result = backend.library.lookup(self.tracks[0].uri)
            self.assertEqual(result, [])

        finally:
            shutil.rmtree(tmpdir)
开发者ID:FabrizioCongia,项目名称:mopidy,代码行数:27,代码来源:test_library.py


示例17: setUp

 def setUp(self):
     config = {
         'audio': {
             'mixer': 'fakemixer track_max_volume=65536',
             'mixer_track': None,
             'output': 'fakesink',
         }
     }
     self.song_uri = path_to_uri(path_to_data_dir('song1.wav'))
     self.audio = audio.Audio.start(config=config).proxy()
开发者ID:Halfnhav,项目名称:mopidy,代码行数:10,代码来源:actor_test.py


示例18: scan

 def scan(self, path):
     paths = path_lib.find_files(path_to_data_dir(path))
     uris = (path_lib.path_to_uri(p) for p in paths)
     scanner = scan.Scanner()
     for uri in uris:
         key = uri[len('file://'):]
         try:
             self.data[key] = scanner.scan(uri)
         except exceptions.ScannerError as error:
             self.errors[key] = error
开发者ID:abarisain,项目名称:mopidy,代码行数:10,代码来源:scan_test.py


示例19: test_playlists_are_loaded_at_startup

    def test_playlists_are_loaded_at_startup(self):
        track = Track(uri=path_to_uri(path_to_data_dir('uri2')))
        playlist = Playlist(tracks=[track], name='test')

        self.stored.save(playlist)

        self.backend = self.backend_class()
        self.stored = self.backend.stored_playlists

        self.assert_(self.stored.playlists)
        self.assertEqual('test', self.stored.playlists[0].name)
        self.assertEqual(track.uri, self.stored.playlists[0].tracks[0].uri)
开发者ID:Dvad,项目名称:mopidy,代码行数:12,代码来源:stored_playlists_test.py


示例20: setUp

 def setUp(self):  # noqa: N802
     config = {
         'audio': {
             'mixer': 'foomixer',
             'mixer_volume': None,
             'output': 'testoutput',
             'visualizer': None,
         },
         'proxy': {
             'hostname': '',
         },
     }
     self.song_uri = path_to_uri(path_to_data_dir('song1.wav'))
     self.audio = self.audio_class.start(config=config, mixer=None).proxy()
开发者ID:FabrizioCongia,项目名称:mopidy,代码行数:14,代码来源:test_actor.py



注:本文中的tests.path_to_data_dir函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python tests.random_datapoint函数代码示例发布时间:2022-05-27
下一篇:
Python tests.op_fixture函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap