本文整理汇总了Python中test._common.item函数的典型用法代码示例。如果您正苦于以下问题:Python item函数的具体用法?Python item怎么用?Python item使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了item函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_heterogeneous_album_gets_single_directory
def test_heterogeneous_album_gets_single_directory(self):
i1, i2 = item(), item()
self.lib.add_album([i1, i2])
i1.year, i2.year = 2009, 2010
self.lib.path_formats = [(u'default', u'$album ($year)/$track $title')]
dest1, dest2 = i1.destination(), i2.destination()
self.assertEqual(os.path.dirname(dest1), os.path.dirname(dest2))
开发者ID:pprkut,项目名称:beets,代码行数:7,代码来源:test_library.py
示例2: setUp
def setUp(self):
super(VFSTest, self).setUp()
self.lib = library.Library(':memory:', path_formats=[
(u'default', u'albums/$album/$title'),
(u'singleton:true', u'tracks/$artist/$title'),
])
self.lib.add(_common.item())
self.lib.add_album([_common.item()])
self.tree = vfs.libtree(self.lib)
开发者ID:Cornellio,项目名称:beets,代码行数:9,代码来源:test_vfs.py
示例3: setUp
def setUp(self):
super(DisambiguationTest, self).setUp()
self.lib = beets.library.Library(':memory:')
self.lib.directory = b'/base'
self.lib.path_formats = [(u'default', u'path')]
self.i1 = item()
self.i1.year = 2001
self.lib.add_album([self.i1])
self.i2 = item()
self.i2.year = 2002
self.lib.add_album([self.i2])
self.lib._connection().commit()
self._setf(u'foo%aunique{albumartist album,year}/$title')
开发者ID:pprkut,项目名称:beets,代码行数:15,代码来源:test_library.py
示例4: setUp
def setUp(self):
self.setup_beets()
self.lib = library.Library(':memory:')
self.item = _common.item()
self.item.path = b'xxx/yyy'
self.lib.add(self.item)
self.lib.add_album([self.item])
开发者ID:shamangeorge,项目名称:beets,代码行数:7,代码来源:test_ui.py
示例5: setUp
def setUp(self):
super(PathQueryTest, self).setUp()
# This is the item we'll try to match.
self.i.path = '/a/b/c.mp3'
self.i.title = u'path item'
self.i.album = u'path album'
self.i.store()
self.lib.add_album([self.i])
# A second item for testing exclusion.
i2 = _common.item()
i2.path = '/x/y/z.mp3'
i2.title = 'another item'
i2.album = 'another album'
self.lib.add(i2)
self.lib.add_album([i2])
# Unadorned path queries with path separators in them are considered
# path queries only when the path in question actually exists. So we
# mock the existence check to return true.
self.patcher_exists = patch('beets.library.os.path.exists')
self.patcher_exists.start().return_value = True
# We have to create function samefile as it does not exist on
# Windows and python 2.7
self.patcher_samefile = patch('beets.library.os.path.samefile',
create=True)
self.patcher_samefile.start().return_value = True
开发者ID:angelsanz,项目名称:beets,代码行数:29,代码来源:test_query.py
示例6: mk_test_album
def mk_test_album(self):
items = [_common.item() for _ in range(3)]
items[0].title = "foo bar"
items[0].artist = "one"
items[0].album = "baz"
items[0].year = 2001
items[0].comp = True
items[1].title = "baz qux"
items[1].artist = "two"
items[1].album = "baz"
items[1].year = 2002
items[1].comp = True
items[2].title = "beets 4 eva"
items[2].artist = "three"
items[2].album = "foo"
items[2].year = 2003
items[2].comp = False
items[2].ipfs = "QmfM9ic5LJj7V6ecozFx1MkSoaaiq3PXfhJoFvyqzpLXSk"
for item in items:
self.lib.add(item)
album = self.lib.add_album(items)
album.ipfs = "QmfM9ic5LJj7V6ecozFx1MkSoaaiq3PXfhJoFvyqzpLXSf"
album.store()
return album
开发者ID:jackwilsdon,项目名称:beets,代码行数:27,代码来源:test_ipfs.py
示例7: setUp
def setUp(self):
self.setup_beets()
self.item = _common.item()
self.item.path = b'xxx/yyy'
self.lib.add(self.item)
self.lib.add_album([self.item])
self.load_plugins()
开发者ID:beetbox,项目名称:beets,代码行数:7,代码来源:test_ui.py
示例8: setUp
def setUp(self):
super(CaseSensitivityTest, self).setUp()
album = _common.album()
album.album = u"album"
album.genre = u"alternative"
album.year = u"2001"
album.flex1 = u"flex1"
album.flex2 = u"flex2-A"
album.albumartist = u"bar"
album.albumartist_sort = None
self.lib.add(album)
item = _common.item()
item.title = u'another'
item.artist = u'lowercase'
item.album = u'album'
item.year = 2001
item.comp = True
item.flex1 = u"flex1"
item.flex2 = u"flex2-A"
item.album_id = album.id
item.artist_sort = None
item.track = 10
self.lib.add(item)
self.new_album = album
self.new_item = item
开发者ID:Cornellio,项目名称:beets,代码行数:28,代码来源:test_sort.py
示例9: setUp
def setUp(self):
self.setup_beets()
self.lib = library.Library(":memory:")
self.item = _common.item()
self.item.path = "xxx/yyy"
self.lib.add(self.item)
self.lib.add_album([self.item])
开发者ID:glamglim,项目名称:beets,代码行数:7,代码来源:test_ui.py
示例10: _set_up_data
def _set_up_data(self):
items = [_common.item() for _ in range(2)]
items[0].title = 'Tessellate'
items[0].artist = 'alt-J'
items[0].albumartist = 'alt-J'
items[0].album = 'An Awesome Wave'
items[0].itunes_rating = 60
items[1].title = 'Breezeblocks'
items[1].artist = 'alt-J'
items[1].albumartist = 'alt-J'
items[1].album = 'An Awesome Wave'
if _is_windows():
items[0].path = \
u'G:\\Music\\Alt-J\\An Awesome Wave\\03 Tessellate.mp3'
items[1].path = \
u'G:\\Music\\Alt-J\\An Awesome Wave\\04 Breezeblocks.mp3'
else:
items[0].path = u'/Music/Alt-J/An Awesome Wave/03 Tessellate.mp3'
items[1].path = u'/Music/Alt-J/An Awesome Wave/04 Breezeblocks.mp3'
for item in items:
self.lib.add(item)
开发者ID:JDLH,项目名称:beets,代码行数:25,代码来源:test_metasync.py
示例11: test_special_char_path_added_to_database
def test_special_char_path_added_to_database(self):
self.i.remove()
path = u'b\xe1r'.encode('utf-8')
i = item()
i.path = path
self.lib.add(i)
i = list(self.lib.items())[0]
self.assertEqual(i.path, path)
开发者ID:pprkut,项目名称:beets,代码行数:8,代码来源:test_library.py
示例12: test_singleton_path
def test_singleton_path(self):
i = item(self.lib)
self.lib.directory = b'one'
self.lib.path_formats = [
(u'default', u'two'),
(u'singleton:true', u'four'),
(u'comp:true', u'three'),
]
self.assertEqual(i.destination(), np('one/four'))
开发者ID:pprkut,项目名称:beets,代码行数:9,代码来源:test_library.py
示例13: test_comp_before_singleton_path
def test_comp_before_singleton_path(self):
i = item(self.lib)
i.comp = True
self.lib.directory = 'one'
self.lib.path_formats = [
('default', 'two'),
('comp:true', 'three'),
('singleton:true', 'four'),
]
self.assertEqual(i.destination(), np('one/three'))
开发者ID:15502119602,项目名称:beets,代码行数:10,代码来源:test_library.py
示例14: setUp
def setUp(self):
super(ShowChangeTest, self).setUp()
self.io.install()
self.items = [_common.item()]
self.items[0].track = 1
self.items[0].path = b'/path/to/file.mp3'
self.info = autotag.AlbumInfo(
u'the album', u'album id', u'the artist', u'artist id',
[autotag.TrackInfo(u'the title', u'track id', index=1)])
开发者ID:dangmai,项目名称:beets,代码行数:10,代码来源:test_ui.py
示例15: test_albuminfo_for_two_items_doesnt_duplicate_row
def test_albuminfo_for_two_items_doesnt_duplicate_row(self):
i2 = item(self.lib)
self.lib.get_album(self.i)
self.lib.get_album(i2)
c = self.lib._connection().cursor()
c.execute('select * from albums where album=?', (self.i.album,))
# Cursor should only return one row.
self.assertNotEqual(c.fetchone(), None)
self.assertEqual(c.fetchone(), None)
开发者ID:pprkut,项目名称:beets,代码行数:10,代码来源:test_library.py
示例16: setUp
def setUp(self):
self.setup_beets()
self.lib = beets.library.Library(':memory:')
self.music_dir = os.path.expanduser(os.path.join('~', 'Music'))
i1 = _common.item()
i1.path = beets.util.normpath(os.path.join(
self.music_dir,
'a', 'b', 'c.mp3',
))
i1.title = u'some item'
i1.album = u'some album'
self.lib.add(i1)
self.lib.add_album([i1])
i2 = _common.item()
i2.path = beets.util.normpath(os.path.join(
self.music_dir,
'd', 'e', 'f.mp3',
))
i2.title = 'another item'
i2.album = 'another album'
self.lib.add(i2)
self.lib.add_album([i2])
i3 = _common.item()
i3.path = beets.util.normpath(os.path.join(
self.music_dir,
'x', 'y', 'z.mp3',
))
i3.title = 'yet another item'
i3.album = 'yet another album'
self.lib.add(i3)
self.lib.add_album([i3])
self.playlist_dir = tempfile.mkdtemp()
self.config['directory'] = self.music_dir
self.config['playlist']['playlist_dir'] = self.playlist_dir
self.setup_test()
self.load_plugins('playlist')
开发者ID:beetbox,项目名称:beets,代码行数:42,代码来源:test_playlist.py
示例17: setUp
def setUp(self):
super(RemoveTest, self).setUp()
# Make library and item.
self.lib = beets.library.Library(':memory:')
self.libdir = os.path.join(self.temp_dir, 'testlibdir')
self.lib.directory = self.libdir
self.i = item(self.lib)
self.i.path = self.i.destination()
# Make a music file.
util.mkdirall(self.i.path)
touch(self.i.path)
# Make an album with the item.
self.ai = self.lib.add_album((self.i,))
开发者ID:RyanScottLewis,项目名称:beets,代码行数:14,代码来源:test_files.py
示例18: test_setart_copies_image
def test_setart_copies_image(self):
os.remove(self.art)
newart = os.path.join(self.libdir, 'newart.jpg')
touch(newart)
i2 = item()
i2.path = self.i.path
i2.artist = u'someArtist'
ai = self.lib.add_album((i2,))
i2.move(True)
self.assertEqual(ai.artpath, None)
ai.set_art(newart)
self.assertTrue(os.path.exists(ai.artpath))
开发者ID:RyanScottLewis,项目名称:beets,代码行数:14,代码来源:test_files.py
示例19: test_setart_to_existing_art_works
def test_setart_to_existing_art_works(self):
os.remove(self.art)
# Original art.
newart = os.path.join(self.libdir, 'newart.jpg')
touch(newart)
i2 = item()
i2.path = self.i.path
i2.artist = u'someArtist'
ai = self.lib.add_album((i2,))
i2.move(True)
ai.set_art(newart)
# Set the art again.
ai.set_art(ai.artpath)
self.assertTrue(os.path.exists(ai.artpath))
开发者ID:RyanScottLewis,项目名称:beets,代码行数:16,代码来源:test_files.py
示例20: test_setart_to_existing_but_unset_art_works
def test_setart_to_existing_but_unset_art_works(self):
newart = os.path.join(self.libdir, 'newart.jpg')
touch(newart)
i2 = item()
i2.path = self.i.path
i2.artist = u'someArtist'
ai = self.lib.add_album((i2,))
i2.move(True)
# Copy the art to the destination.
artdest = ai.art_destination(newart)
shutil.copy(newart, artdest)
# Set the art again.
ai.set_art(artdest)
self.assertTrue(os.path.exists(ai.artpath))
开发者ID:RyanScottLewis,项目名称:beets,代码行数:16,代码来源:test_files.py
注:本文中的test._common.item函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论