247247class FSTestCases (object ):
248248 """Basic FS tests."""
249249
250+ data1 = b"foo" * 256 * 1024
251+ data2 = b"bar" * 2 * 256 * 1024
252+ data3 = b"baz" * 3 * 256 * 1024
253+ data4 = b"egg" * 7 * 256 * 1024
254+
250255 def make_fs (self ):
251256 """Return an FS instance."""
252257 raise NotImplementedError ("implement me" )
@@ -1191,22 +1196,17 @@ def test_copy(self):
11911196
11921197 def _test_upload (self , workers ):
11931198 """Test fs.copy with varying number of worker threads."""
1194- data1 = b"foo" * 256 * 1024
1195- data2 = b"bar" * 2 * 256 * 1024
1196- data3 = b"baz" * 3 * 256 * 1024
1197- data4 = b"egg" * 7 * 256 * 1024
1198-
11991199 with open_fs ("temp://" ) as src_fs :
1200- src_fs .writebytes ("foo" , data1 )
1201- src_fs .writebytes ("bar" , data2 )
1202- src_fs .makedir ("dir1" ).writebytes ("baz" , data3 )
1203- src_fs .makedirs ("dir2/dir3" ).writebytes ("egg" , data4 )
1200+ src_fs .writebytes ("foo" , self . data1 )
1201+ src_fs .writebytes ("bar" , self . data2 )
1202+ src_fs .makedir ("dir1" ).writebytes ("baz" , self . data3 )
1203+ src_fs .makedirs ("dir2/dir3" ).writebytes ("egg" , self . data4 )
12041204 dst_fs = self .fs
12051205 fs .copy .copy_fs (src_fs , dst_fs , workers = workers )
1206- self .assertEqual (dst_fs .readbytes ("foo" ), data1 )
1207- self .assertEqual (dst_fs .readbytes ("bar" ), data2 )
1208- self .assertEqual (dst_fs .readbytes ("dir1/baz" ), data3 )
1209- self .assertEqual (dst_fs .readbytes ("dir2/dir3/egg" ), data4 )
1206+ self .assertEqual (dst_fs .readbytes ("foo" ), self . data1 )
1207+ self .assertEqual (dst_fs .readbytes ("bar" ), self . data2 )
1208+ self .assertEqual (dst_fs .readbytes ("dir1/baz" ), self . data3 )
1209+ self .assertEqual (dst_fs .readbytes ("dir2/dir3/egg" ), self . data4 )
12101210
12111211 def test_upload_0 (self ):
12121212 self ._test_upload (0 )
@@ -1222,21 +1222,17 @@ def test_upload_4(self):
12221222
12231223 def _test_download (self , workers ):
12241224 """Test fs.copy with varying number of worker threads."""
1225- data1 = b"foo" * 256 * 1024
1226- data2 = b"bar" * 2 * 256 * 1024
1227- data3 = b"baz" * 3 * 256 * 1024
1228- data4 = b"egg" * 7 * 256 * 1024
12291225 src_fs = self .fs
12301226 with open_fs ("temp://" ) as dst_fs :
1231- src_fs .writebytes ("foo" , data1 )
1232- src_fs .writebytes ("bar" , data2 )
1233- src_fs .makedir ("dir1" ).writebytes ("baz" , data3 )
1234- src_fs .makedirs ("dir2/dir3" ).writebytes ("egg" , data4 )
1227+ src_fs .writebytes ("foo" , self . data1 )
1228+ src_fs .writebytes ("bar" , self . data2 )
1229+ src_fs .makedir ("dir1" ).writebytes ("baz" , self . data3 )
1230+ src_fs .makedirs ("dir2/dir3" ).writebytes ("egg" , self . data4 )
12351231 fs .copy .copy_fs (src_fs , dst_fs , workers = workers )
1236- self .assertEqual (dst_fs .readbytes ("foo" ), data1 )
1237- self .assertEqual (dst_fs .readbytes ("bar" ), data2 )
1238- self .assertEqual (dst_fs .readbytes ("dir1/baz" ), data3 )
1239- self .assertEqual (dst_fs .readbytes ("dir2/dir3/egg" ), data4 )
1232+ self .assertEqual (dst_fs .readbytes ("foo" ), self . data1 )
1233+ self .assertEqual (dst_fs .readbytes ("bar" ), self . data2 )
1234+ self .assertEqual (dst_fs .readbytes ("dir1/baz" ), self . data3 )
1235+ self .assertEqual (dst_fs .readbytes ("dir2/dir3/egg" ), self . data4 )
12401236
12411237 def test_download_0 (self ):
12421238 self ._test_download (0 )
0 commit comments