aboutsummaryrefslogtreecommitdiff
path: root/pyfakefs/tests/fake_filesystem_glob_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyfakefs/tests/fake_filesystem_glob_test.py')
-rw-r--r--pyfakefs/tests/fake_filesystem_glob_test.py60
1 files changed, 34 insertions, 26 deletions
diff --git a/pyfakefs/tests/fake_filesystem_glob_test.py b/pyfakefs/tests/fake_filesystem_glob_test.py
index 7432fa8..1ca141f 100644
--- a/pyfakefs/tests/fake_filesystem_glob_test.py
+++ b/pyfakefs/tests/fake_filesystem_glob_test.py
@@ -24,51 +24,59 @@ from pyfakefs import fake_filesystem_unittest
class FakeGlobUnitTest(fake_filesystem_unittest.TestCase):
def setUp(self):
self.setUpPyfakefs()
- directory = './xyzzy'
+ directory = "./xyzzy"
self.fs.create_dir(directory)
- self.fs.create_dir('%s/subdir' % directory)
- self.fs.create_dir('%s/subdir2' % directory)
- self.fs.create_file('%s/subfile' % directory)
- self.fs.create_file('[Temp]')
+ self.fs.create_dir("%s/subdir" % directory)
+ self.fs.create_dir("%s/subdir2" % directory)
+ self.fs.create_file("%s/subfile" % directory)
+ self.fs.create_file("[Temp]")
def test_glob_empty(self):
- self.assertEqual(glob.glob(''), [])
+ self.assertEqual(glob.glob(""), [])
def test_glob_star(self):
- basedir = '/xyzzy'
- self.assertEqual([os.path.join(basedir, 'subdir'),
- os.path.join(basedir, 'subdir2'),
- os.path.join(basedir, 'subfile')],
- sorted(glob.glob('/xyzzy/*')))
+ basedir = "/xyzzy"
+ self.assertEqual(
+ [
+ os.path.join(basedir, "subdir"),
+ os.path.join(basedir, "subdir2"),
+ os.path.join(basedir, "subfile"),
+ ],
+ sorted(glob.glob("/xyzzy/*")),
+ )
def test_glob_exact(self):
- self.assertEqual(['/xyzzy'], glob.glob('/xyzzy'))
- self.assertEqual(['/xyzzy/subfile'], glob.glob('/xyzzy/subfile'))
+ self.assertEqual(["/xyzzy"], glob.glob("/xyzzy"))
+ self.assertEqual(["/xyzzy/subfile"], glob.glob("/xyzzy/subfile"))
def test_glob_question(self):
- basedir = '/xyzzy'
- self.assertEqual([os.path.join(basedir, 'subdir'),
- os.path.join(basedir, 'subdir2'),
- os.path.join(basedir, 'subfile')],
- sorted(glob.glob('/x?zz?/*')))
+ basedir = "/xyzzy"
+ self.assertEqual(
+ [
+ os.path.join(basedir, "subdir"),
+ os.path.join(basedir, "subdir2"),
+ os.path.join(basedir, "subfile"),
+ ],
+ sorted(glob.glob("/x?zz?/*")),
+ )
def test_glob_no_magic(self):
- self.assertEqual(['/xyzzy'], glob.glob('/xyzzy'))
- self.assertEqual(['/xyzzy/subdir'], glob.glob('/xyzzy/subdir'))
+ self.assertEqual(["/xyzzy"], glob.glob("/xyzzy"))
+ self.assertEqual(["/xyzzy/subdir"], glob.glob("/xyzzy/subdir"))
def test_non_existent_path(self):
- self.assertEqual([], glob.glob('nonexistent'))
+ self.assertEqual([], glob.glob("nonexistent"))
def test_magic_dir(self):
- self.assertEqual(['/[Temp]'], glob.glob('/*emp*'))
+ self.assertEqual(["/[Temp]"], glob.glob("/*emp*"))
def test_glob1(self):
- self.assertEqual(['[Temp]'], glob.glob1('/', '*Tem*'))
+ self.assertEqual(["[Temp]"], glob.glob1("/", "*Tem*"))
def test_has_magic(self):
- self.assertTrue(glob.has_magic('['))
- self.assertFalse(glob.has_magic('a'))
+ self.assertTrue(glob.has_magic("["))
+ self.assertFalse(glob.has_magic("a"))
-if __name__ == '__main__':
+if __name__ == "__main__":
unittest.main()