@@ -92,13 +92,13 @@ def test_move_dir(self):
9292
9393class TestMove (unittest .TestCase ):
9494 def test_move_file_tempfs (self ):
95- with open_fs ("temp://" ) as a , open_fs ("temp://" ) as b :
96- dir_a = a .makedir ("dir " )
97- dir_b = b . makedir ( "subdir " )
98- dir_b . writetext ( "file.txt" , "Content " )
99- fs .move .move_file (dir_b , "file.txt" , dir_a , "here .txt" )
100- self .assertEqual (a .readtext ("dir/here .txt" ), "Content" )
101- self .assertFalse (b .exists ("subdir /file.txt" ))
95+ with open_fs ("temp://" ) as src , open_fs ("temp://" ) as dst :
96+ src_dir = src .makedir ("Some subfolder " )
97+ src_dir . writetext ( "file.txt" , "Content " )
98+ dst_dir = dst . makedir ( "dest dir " )
99+ fs .move .move_file (src_dir , "file.txt" , dst_dir , "target .txt" )
100+ self .assertEqual (dst .readtext ("dest dir/target .txt" ), "Content" )
101+ self .assertFalse (src .exists ("Some subfolder /file.txt" ))
102102
103103 def test_move_file_fs_urls (self ):
104104 # create a temp dir to work on
@@ -111,10 +111,10 @@ def test_move_file_fs_urls(self):
111111 "osfs://" + join (path , "subdir_src" ),
112112 "file.txt" ,
113113 "osfs://" + join (path , "subdir_dst" ),
114- "file .txt" ,
114+ "target .txt" ,
115115 )
116116 self .assertFalse (subdir_src .exists ("file.txt" ))
117- self .assertEqual (tmp .readtext ("subdir_dst/file .txt" ), "Content" )
117+ self .assertEqual (tmp .readtext ("subdir_dst/target .txt" ), "Content" )
118118
119119 def test_move_file_same_fs_read_only_source (self ):
120120 with open_fs ("temp://" ) as tmp :
@@ -123,21 +123,21 @@ def test_move_file_same_fs_read_only_source(self):
123123 src = read_only (open_fs (path ))
124124 dst = tmp .makedir ("sub" )
125125 with self .assertRaises (ResourceReadOnly ):
126- fs .move .move_file (src , "file.txt" , dst , "file .txt" )
126+ fs .move .move_file (src , "file.txt" , dst , "target_file .txt" )
127127 self .assertFalse (
128- dst .exists ("file .txt" ), "file should not have been copied over"
128+ dst .exists ("target_file .txt" ), "file should not have been copied over"
129129 )
130130 self .assertTrue (src .exists ("file.txt" ))
131131
132132 def test_move_file_read_only_mem_source (self ):
133133 with open_fs ("mem://" ) as src , open_fs ("mem://" ) as dst :
134134 src .writetext ("file.txt" , "Content" )
135- sub = dst .makedir ("sub" )
135+ dst_sub = dst .makedir ("sub" )
136136 src_ro = read_only (src )
137137 with self .assertRaises (ResourceReadOnly ):
138- fs .move .move_file (src_ro , "file.txt" , sub , "file .txt" )
138+ fs .move .move_file (src_ro , "file.txt" , dst_sub , "target .txt" )
139139 self .assertFalse (
140- sub .exists ("file .txt" ), "file should not have been copied over"
140+ dst_sub .exists ("target .txt" ), "file should not have been copied over"
141141 )
142142 self .assertTrue (src .exists ("file.txt" ))
143143
@@ -146,9 +146,9 @@ def test_move_file_read_only_mem_dest(self):
146146 src .writetext ("file.txt" , "Content" )
147147 dst_ro = read_only (dst )
148148 with self .assertRaises (ResourceReadOnly ):
149- fs .move .move_file (src , "file.txt" , dst_ro , "file .txt" )
149+ fs .move .move_file (src , "file.txt" , dst_ro , "target .txt" )
150150 self .assertFalse (
151- dst_ro .exists ("file .txt" ), "file should not have been copied over"
151+ dst_ro .exists ("target .txt" ), "file should not have been copied over"
152152 )
153153 self .assertTrue (src .exists ("file.txt" ))
154154
@@ -158,9 +158,9 @@ def test_move_file_cleanup_on_error(self):
158158 with mock .patch .object (src , "remove" ) as mck :
159159 mck .side_effect = FSError
160160 with self .assertRaises (FSError ):
161- fs .move .move_file (src , "file.txt" , dst , "file .txt" )
161+ fs .move .move_file (src , "file.txt" , dst , "target .txt" )
162162 self .assertTrue (src .exists ("file.txt" ))
163- self .assertFalse (dst .exists ("file .txt" ))
163+ self .assertFalse (dst .exists ("target .txt" ))
164164
165165 def test_move_file_no_cleanup_on_error (self ):
166166 with open_fs ("mem://" ) as src , open_fs ("mem://" ) as dst :
@@ -169,7 +169,7 @@ def test_move_file_no_cleanup_on_error(self):
169169 mck .side_effect = FSError
170170 with self .assertRaises (FSError ):
171171 fs .move .move_file (
172- src , "file.txt" , dst , "file .txt" , cleanup_dest_on_error = False
172+ src , "file.txt" , dst , "target .txt" , cleanup_dst_on_error = False
173173 )
174174 self .assertTrue (src .exists ("file.txt" ))
175- self .assertTrue (dst .exists ("file .txt" ))
175+ self .assertTrue (dst .exists ("target .txt" ))
0 commit comments