def test_copy_file(): """Test copying an Image file object.""" # If pathnames don't work a switch may be needed # using: platform.system() == 'Windows' sourcefile = "./test/testsource/(814837) ろさ - 空と私.jpg" destpath = "./test/testdestination" re_pattern = re.compile("(?<=^\()\d*(?=\))") img = Image(sourcefile, re_pattern) img.copy(destpath) destfile = "./test/testdestination/(814837) ろさ - 空と私.jpg" assert os.path.exists(destfile) # Move image back. img2 = Image(destfile, re_pattern) img2.copy(sourcefile)
def test_copy_dir(): """Test copying an Image directory object.""" # If pathnames don't work a switch will be needed # using: platform.system() == 'Windows' # Location of the test directory and the test destination sourcefile = "./test/testsource/(206921) cherrypin - イラスト集め" destpath = "./test/testdestination" # Create Image object and move it to the test destination re_pattern = re.compile("(?<=^\()\d*(?=\))") img = Image(sourcefile, re_pattern) img.copy(destpath) # The directory and it's contents should now be at the test destination destfile = "./test/testdestination/(206921) cherrypin - イラスト集め" # If not the test fails assert os.path.exists(destfile) # Move directory back in place. img2 = Image(destfile, re_pattern) img2.copy("./test/testsource")