From bea77370c483a46bfb048ae925f4780c0e8b9472 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Wed, 8 Jun 2016 10:34:21 -0700 Subject: [PATCH] Simpler absolute path detection test --- test/test_query.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/test/test_query.py b/test/test_query.py index 92fc57495..355488a39 100644 --- a/test/test_query.py +++ b/test/test_query.py @@ -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.