From 603fe61cb4aa0aac30108c51b56902c8fc05fd4a Mon Sep 17 00:00:00 2001 From: liamhuber Date: Tue, 28 May 2024 10:07:13 -0700 Subject: [PATCH] PEP8 --- tests/unit/test_files.py | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/tests/unit/test_files.py b/tests/unit/test_files.py index d970799..146f376 100644 --- a/tests/unit/test_files.py +++ b/tests/unit/test_files.py @@ -34,7 +34,6 @@ def test_file_instantiation(self): else: self.assertRaises(ValueError, FileObject, "/test.txt", "test") - def test_directory_exists(self): self.assertTrue(Path("test").exists() and Path("test").is_dir()) @@ -122,26 +121,25 @@ def test_remove(self): ) def test_copy(self): - f = FileObject("test_copy.txt", self.directory) - f.write("sam wrote this wondrful thing") - new_file_1 = f.copy("another_test") - self.assertEqual(new_file_1.read(), "sam wrote this wondrful thing") - new_file_2 = f.copy("another_test", ".") - with open("another_test", "r") as file: - txt = file.read() - self.assertEqual(txt, "sam wrote this wondrful thing") - new_file_2.delete() # needed because current directory - new_file_3 = f.copy(str(f.path.parent / "another_test"), ".") - self.assertEqual(new_file_1.path.absolute(), new_file_3.path.absolute()) - new_file_4 = f.copy(directory=".") - with open("test_copy.txt", "r") as file: - txt = file.read() - self.assertEqual(txt, "sam wrote this wondrful thing") - new_file_4.delete() # needed because current directory - with self.assertRaises(ValueError): + f = FileObject("test_copy.txt", self.directory) + f.write("sam wrote this wondrful thing") + new_file_1 = f.copy("another_test") + self.assertEqual(new_file_1.read(), "sam wrote this wondrful thing") + new_file_2 = f.copy("another_test", ".") + with open("another_test", "r") as file: + txt = file.read() + self.assertEqual(txt, "sam wrote this wondrful thing") + new_file_2.delete() # needed because current directory + new_file_3 = f.copy(str(f.path.parent / "another_test"), ".") + self.assertEqual(new_file_1.path.absolute(), new_file_3.path.absolute()) + new_file_4 = f.copy(directory=".") + with open("test_copy.txt", "r") as file: + txt = file.read() + self.assertEqual(txt, "sam wrote this wondrful thing") + new_file_4.delete() # needed because current directory + with self.assertRaises(ValueError): f.copy() - def test_str(self): f = FileObject("test_copy.txt", self.directory) if platform.system() == "Windows": @@ -150,5 +148,6 @@ def test_str(self): txt = f"my file: {self.directory.path.absolute()}/test_copy.txt" self.assertEqual(f"my file: {f}", txt) + if __name__ == '__main__': unittest.main()