mirror of
https://github.com/beetbox/beets.git
synced 2026-01-03 14:32:55 +01:00
Simpler absolute path detection test
This commit is contained in:
parent
416593fbf8
commit
bea77370c4
1 changed files with 10 additions and 4 deletions
|
|
@ -588,11 +588,17 @@ class PathQueryTest(_common.LibTestCase, TestHelper, AssertsMixin):
|
|||
is_path = beets.library.PathQuery.is_path_query
|
||||
|
||||
try:
|
||||
self.touch(os.path.join('foo', 'bar'))
|
||||
path = self.touch(os.path.join('foo', 'bar'))
|
||||
|
||||
self.assertTrue(is_path(os.path.join(self.temp_dir, b'foo/bar')))
|
||||
self.assertTrue(is_path(os.path.join(self.temp_dir, b'foo')))
|
||||
self.assertFalse(is_path(b'foo/bar'))
|
||||
# The file itself.
|
||||
self.assertTrue(is_path(path))
|
||||
|
||||
# The parent directory.
|
||||
parent = os.path.dirname(path)
|
||||
self.assertTrue(is_path(parent))
|
||||
|
||||
# Some non-existent path.
|
||||
self.assertFalse(is_path(path + b'baz'))
|
||||
|
||||
finally:
|
||||
# Restart the `os.path.exists` patch.
|
||||
|
|
|
|||
Loading…
Reference in a new issue