예제 #1
0
    def test_create_tuple(self):
        dirpath = tempfile.mkdtemp()
        Folders.create(dirpath, "foo")
        Files.create((dirpath, "foo"), "a.txt", b"bar")

        filepath = os.path.join(dirpath, "foo", "a.txt")
        assert open(filepath, "rb").read() == b"bar"
예제 #2
0
 def test_create_bytesio(self):
     dirpath = tempfile.mkdtemp()
     filepath = Files.create(dirpath, "a.txt", io.BytesIO(b"A" * 1024 * 1024))
     assert open(filepath, "rb").read() == b"A" * 1024 * 1024
예제 #3
0
 def test_create(self):
     dirpath = tempfile.mkdtemp()
     Files.create(dirpath, "a.txt", b"foo")
     assert open(os.path.join(dirpath, "a.txt"), "rb").read() == b"foo"
     shutil.rmtree(dirpath)