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"
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
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)