1
# =============================================================================
3
# Remuco - A remote control system for media players.
4
# Copyright (C) 2006-2009 Oben Sonne <obensonne@googlemail.com>
6
# This file is part of Remuco.
8
# Remuco is free software: you can redistribute it and/or modify
9
# it under the terms of the GNU General Public License as published by
10
# the Free Software Foundation, either version 3 of the License, or
11
# (at your option) any later version.
13
# Remuco is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
# GNU General Public License for more details.
18
# You should have received a copy of the GNU General Public License
19
# along with Remuco. If not, see <http://www.gnu.org/licenses/>.
21
# =============================================================================
25
from remuco.files import FileSystemLibrary
28
class FilesTest(unittest.TestCase):
39
def __test_path(self, fs, path, depth, limit):
41
nested, ids, names = fs.get_level(path)
43
#print("%spath : %s" % (depth, path))
45
# print("%snested : %s" % (depth, nested))
47
# print("%sids : %s" % (depth, ids))
49
# print("%snames : %s" % (depth, names))
51
if len(depth) == limit * 2:
58
self.__test_path(fs, path + [sub], depth + " ", limit)
64
fs = FileSystemLibrary(None, ["audio","video"], False, False, True)
66
self.__test_path(fs, None, "", limit=0)
67
self.__test_path(fs, [], "", limit=2)
69
fs = FileSystemLibrary([ "/home", "/nonexistent" ],
70
["audio/mp3", "video/mp4", "application/x-iso9660-image"],
73
self.__test_path(fs, [], "", limit=3)
75
if __name__ == "__main__":
b'\\ No newline at end of file'