Debian Codegraph @

test/plugins/utils/test_vfs.py

raw
1 """Tests for the virtual filesystem builder.."""
2
3 from beets.test import _common
4 from beets.test.helper import BeetsTestCase
5 from beetsplug._utils import vfs
6
7
8 class VFSTest(BeetsTestCase):
9 def setUp(self):
10 super().setUp()
11 self.lib.path_formats = [
12 ("default", "albums/$album/$title"),
13 ("singleton:true", "tracks/$artist/$title"),
14 ]
15 self.lib.add(_common.item())
16 self.lib.add_album([_common.item()])
17 self.tree = vfs.libtree(self.lib)
18
19 def test_singleton_item(self):
20 assert (
21 self.tree.dirs["tracks"].dirs["the artist"].files["the title"] == 1
22 )
23
24 def test_album_item(self):
25 assert (
26 self.tree.dirs["albums"].dirs["the album"].files["the title"] == 2
27 )