summaryrefslogtreecommitdiff
path: root/fs/tests/test_utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'fs/tests/test_utils.py')
-rw-r--r--fs/tests/test_utils.py66
1 files changed, 33 insertions, 33 deletions
diff --git a/fs/tests/test_utils.py b/fs/tests/test_utils.py
index d2e435f..f0d336c 100644
--- a/fs/tests/test_utils.py
+++ b/fs/tests/test_utils.py
@@ -7,14 +7,14 @@ from fs import utils
from six import b
class TestUtils(unittest.TestCase):
-
+
def _make_fs(self, fs):
fs.setcontents("f1", b("file 1"))
fs.setcontents("f2", b("file 2"))
fs.setcontents("f3", b("file 3"))
fs.makedir("foo/bar", recursive=True)
fs.setcontents("foo/bar/fruit", b("apple"))
-
+
def _check_fs(self, fs):
self.assert_(fs.isfile("f1"))
self.assert_(fs.isfile("f2"))
@@ -24,72 +24,72 @@ class TestUtils(unittest.TestCase):
self.assertEqual(fs.getcontents("f1", "rb"), b("file 1"))
self.assertEqual(fs.getcontents("f2", "rb"), b("file 2"))
self.assertEqual(fs.getcontents("f3", "rb"), b("file 3"))
- self.assertEqual(fs.getcontents("foo/bar/fruit", "rb"), b("apple"))
-
+ self.assertEqual(fs.getcontents("foo/bar/fruit", "rb"), b("apple"))
+
def test_copydir_root(self):
"""Test copydir from root"""
fs1 = MemoryFS()
- self._make_fs(fs1)
+ self._make_fs(fs1)
fs2 = MemoryFS()
- utils.copydir(fs1, fs2)
+ utils.copydir(fs1, fs2)
self._check_fs(fs2)
-
+
fs1 = TempFS()
- self._make_fs(fs1)
+ self._make_fs(fs1)
fs2 = TempFS()
- utils.copydir(fs1, fs2)
+ utils.copydir(fs1, fs2)
self._check_fs(fs2)
-
+
def test_copydir_indir(self):
- """Test copydir in a directory"""
+ """Test copydir in a directory"""
fs1 = MemoryFS()
fs2 = MemoryFS()
- self._make_fs(fs1)
- utils.copydir(fs1, (fs2, "copy"))
+ self._make_fs(fs1)
+ utils.copydir(fs1, (fs2, "copy"))
self._check_fs(fs2.opendir("copy"))
fs1 = TempFS()
fs2 = TempFS()
- self._make_fs(fs1)
- utils.copydir(fs1, (fs2, "copy"))
+ self._make_fs(fs1)
+ utils.copydir(fs1, (fs2, "copy"))
self._check_fs(fs2.opendir("copy"))
-
+
def test_movedir_indir(self):
- """Test movedir in a directory"""
+ """Test movedir in a directory"""
fs1 = MemoryFS()
fs2 = MemoryFS()
fs1sub = fs1.makeopendir("from")
- self._make_fs(fs1sub)
- utils.movedir((fs1, "from"), (fs2, "copy"))
- self.assert_(not fs1.exists("from"))
+ self._make_fs(fs1sub)
+ utils.movedir((fs1, "from"), (fs2, "copy"))
+ self.assert_(not fs1.exists("from"))
self._check_fs(fs2.opendir("copy"))
fs1 = TempFS()
fs2 = TempFS()
fs1sub = fs1.makeopendir("from")
- self._make_fs(fs1sub)
+ self._make_fs(fs1sub)
utils.movedir((fs1, "from"), (fs2, "copy"))
- self.assert_(not fs1.exists("from"))
+ self.assert_(not fs1.exists("from"))
self._check_fs(fs2.opendir("copy"))
-
+
def test_movedir_root(self):
- """Test movedir to root dir"""
+ """Test movedir to root dir"""
fs1 = MemoryFS()
fs2 = MemoryFS()
fs1sub = fs1.makeopendir("from")
- self._make_fs(fs1sub)
+ self._make_fs(fs1sub)
utils.movedir((fs1, "from"), fs2)
- self.assert_(not fs1.exists("from"))
+ self.assert_(not fs1.exists("from"))
self._check_fs(fs2)
fs1 = TempFS()
fs2 = TempFS()
fs1sub = fs1.makeopendir("from")
- self._make_fs(fs1sub)
+ self._make_fs(fs1sub)
utils.movedir((fs1, "from"), fs2)
- self.assert_(not fs1.exists("from"))
+ self.assert_(not fs1.exists("from"))
self._check_fs(fs2)
-
+
def test_remove_all(self):
"""Test remove_all function"""
fs = TempFS()
@@ -97,9 +97,9 @@ class TestUtils(unittest.TestCase):
fs.setcontents("f2", b("file 2"))
fs.setcontents("f3", b("file 3"))
fs.makedir("foo/bar", recursive=True)
- fs.setcontents("foo/bar/fruit", b("apple"))
+ fs.setcontents("foo/bar/fruit", b("apple"))
fs.setcontents("foo/baz", b("baz"))
-
+
utils.remove_all(fs, "foo/bar")
self.assert_(not fs.exists("foo/bar/fruit"))
self.assert_(fs.exists("foo/bar"))
@@ -111,5 +111,5 @@ class TestUtils(unittest.TestCase):
self.assert_(not fs.exists("foo"))
self.assert_(not fs.exists("f1"))
self.assert_(fs.isdirempty('/'))
-
-
+
+