本文整理汇总了Python中test._common.item函数的典型用法代码示例。如果您正苦于以下问题:Python item函数的具体用法?Python item怎么用?Python item使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了item函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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))
示例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)
示例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')
示例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])
示例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
示例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
示例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()
示例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
示例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])
示例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)
示例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)
示例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'))
示例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'))
示例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)])
示例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)