1111def test_is_async ():
1212 fs = fsspec .filesystem ("file" )
1313 async_fs = AsyncFileSystemWrapper (fs )
14- assert async_fs .async_impl == True
14+ assert async_fs .async_impl
1515
1616
1717def test_class_wrapper ():
1818 fs_cls = LocalFileSystem
1919 async_fs_cls = AsyncFileSystemWrapper .wrap_class (fs_cls )
2020 assert async_fs_cls .__name__ == "AsyncLocalFileSystemWrapper"
2121 async_fs = async_fs_cls ()
22- assert async_fs .async_impl == True
22+ assert async_fs .async_impl
2323
2424
2525@pytest .mark .asyncio
2626async def test_cats ():
2727 with filetexts (csv_files , mode = "b" ):
2828 fs = fsspec .filesystem ("file" )
2929 async_fs = AsyncFileSystemWrapper (fs )
30-
30+
3131 result = await async_fs ._cat (".test.fakedata.1.csv" )
3232 assert result == b"a,b\n 1,2\n "
3333
34- out = set ((await async_fs ._cat ([".test.fakedata.1.csv" , ".test.fakedata.2.csv" ])).values ())
34+ out = set (
35+ (
36+ await async_fs ._cat ([".test.fakedata.1.csv" , ".test.fakedata.2.csv" ])
37+ ).values ()
38+ )
3539 assert out == {b"a,b\n 1,2\n " , b"a,b\n 3,4\n " }
3640
3741 result = await async_fs ._cat (".test.fakedata.1.csv" , None , None )
@@ -51,12 +55,15 @@ async def test_cats():
5155 assert result == b"a,b\n 1,2\n " [1 :- 2 ]
5256
5357 out = set (
54- (await async_fs ._cat (
55- [".test.fakedata.1.csv" , ".test.fakedata.2.csv" ], start = 1 , end = - 1
56- )).values ()
58+ (
59+ await async_fs ._cat (
60+ [".test.fakedata.1.csv" , ".test.fakedata.2.csv" ], start = 1 , end = - 1
61+ )
62+ ).values ()
5763 )
5864 assert out == {b"a,b\n 1,2\n " [1 :- 1 ], b"a,b\n 3,4\n " [1 :- 1 ]}
5965
66+
6067@pytest .mark .asyncio
6168async def test_basic_crud_operations ():
6269 with filetexts (csv_files , mode = "b" ):
@@ -76,6 +83,7 @@ async def test_basic_crud_operations():
7683 await async_fs ._rm (".test.fakedata.1.csv" )
7784 assert not await async_fs ._exists (".test.fakedata.1.csv" )
7885
86+
7987@pytest .mark .asyncio
8088async def test_error_handling ():
8189 fs = fsspec .filesystem ("file" )
@@ -87,6 +95,7 @@ async def test_error_handling():
8795 with pytest .raises (FileNotFoundError ):
8896 await async_fs ._rm (".test.non_existent.csv" )
8997
98+
9099@pytest .mark .asyncio
91100async def test_concurrent_operations ():
92101 with filetexts (csv_files , mode = "b" ):
@@ -99,11 +108,12 @@ async def read_file(file_path):
99108 results = await asyncio .gather (
100109 read_file (".test.fakedata.1.csv" ),
101110 read_file (".test.fakedata.2.csv" ),
102- read_file (".test.fakedata.1.csv" )
111+ read_file (".test.fakedata.1.csv" ),
103112 )
104113
105114 assert results == [b"a,b\n 1,2\n " , b"a,b\n 3,4\n " , b"a,b\n 1,2\n " ]
106115
116+
107117@pytest .mark .asyncio
108118async def test_directory_operations ():
109119 with filetexts (csv_files , mode = "b" ):
@@ -120,6 +130,7 @@ async def test_directory_operations():
120130 assert ".test.fakedata.2.csv" in filenames
121131 assert "new_directory" in filenames
122132
133+
123134@pytest .mark .asyncio
124135async def test_batch_operations ():
125136 with filetexts (csv_files , mode = "b" ):
@@ -128,4 +139,4 @@ async def test_batch_operations():
128139
129140 await async_fs ._rm ([".test.fakedata.1.csv" , ".test.fakedata.2.csv" ])
130141 assert not await async_fs ._exists (".test.fakedata.1.csv" )
131- assert not await async_fs ._exists (".test.fakedata.2.csv" )
142+ assert not await async_fs ._exists (".test.fakedata.2.csv" )
0 commit comments