@@ -268,3 +268,53 @@ def test_get_kwargs_from_urls_hadoop_fs():
268268 assert kwargs ["host" ] == "localhost"
269269 assert kwargs ["port" ] == 8020
270270 assert "replication" not in kwargs
271+
272+
273+ def test_get_file_seekable_default (fs , remote_dir , tmp_path ):
274+ """Test that get_file defaults to seekable=False but allows override."""
275+ data = b"test data for seekable"
276+
277+ # Create a test file
278+ with fs .open (remote_dir + "/test_file.txt" , "wb" ) as f :
279+ f .write (data )
280+
281+ # Test default behavior (seekable=False)
282+ local_file = tmp_path / "test_default.txt"
283+ fs .get_file (remote_dir + "/test_file.txt" , str (local_file ))
284+ with open (local_file , "rb" ) as f :
285+ assert f .read () == data
286+
287+ # Test with explicit seekable=True
288+ local_file_seekable = tmp_path / "test_seekable.txt"
289+ fs .get_file (remote_dir + "/test_file.txt" , str (local_file_seekable ), seekable = True )
290+ with open (local_file_seekable , "rb" ) as f :
291+ assert f .read () == data
292+
293+ # Test with explicit seekable=False
294+ local_file_not_seekable = tmp_path / "test_not_seekable.txt"
295+ fs .get_file (
296+ remote_dir + "/test_file.txt" , str (local_file_not_seekable ), seekable = False
297+ )
298+ with open (local_file_not_seekable , "rb" ) as f :
299+ assert f .read () == data
300+
301+
302+ def test_cat_file_seekable_override (fs , remote_dir ):
303+ """Test that cat_file allows seekable to be overridden."""
304+ data = b"test data for cat_file seekable"
305+
306+ # Create a test file
307+ with fs .open (remote_dir + "/test_cat.txt" , "wb" ) as f :
308+ f .write (data )
309+
310+ # Test default behavior - when start is None, seekable should default to False
311+ result = fs .cat_file (remote_dir + "/test_cat.txt" )
312+ assert result == data
313+
314+ # Test with explicit seekable=True even when start is None
315+ result = fs .cat_file (remote_dir + "/test_cat.txt" , seekable = True )
316+ assert result == data
317+
318+ # Test with explicit seekable=False
319+ result = fs .cat_file (remote_dir + "/test_cat.txt" , seekable = False )
320+ assert result == data
0 commit comments