@@ -135,3 +135,63 @@ def test_webhdfs_cp_file(hdfs_cluster):
135135 assert fs .exists (src )
136136 assert fs .exists (dst )
137137 assert fs .cat (src ) == fs .cat (dst )
138+
139+
140+ def test_path_with_equals (hdfs_cluster ):
141+ fs = WebHDFS (
142+ hdfs_cluster , user = "testuser" , data_proxy = {"worker.example.com" : "localhost" }
143+ )
144+ path_with_equals = "/user/testuser/some_table/datestamp=2023-11-11"
145+
146+ fs .mkdir (path_with_equals )
147+
148+ result = fs .ls (path_with_equals )
149+ assert result is not None
150+ assert fs .exists (path_with_equals )
151+
152+
153+ def test_error_handling_with_equals_in_path (hdfs_cluster ):
154+ fs = WebHDFS (hdfs_cluster , user = "testuser" )
155+ invalid_path_with_equals = (
156+ "/user/testuser/some_table/invalid_path=datestamp=2023-11-11"
157+ )
158+
159+ with pytest .raises (FileNotFoundError ):
160+ fs .ls (invalid_path_with_equals )
161+
162+
163+ def test_create_and_touch_file_with_equals (hdfs_cluster ):
164+ fs = WebHDFS (
165+ hdfs_cluster ,
166+ user = "testuser" ,
167+ data_proxy = {"worker.example.com" : "localhost" },
168+ )
169+ base_path = "/user/testuser/some_table/datestamp=2023-11-11"
170+ file_path = f"{ base_path } /testfile.txt"
171+
172+ fs .mkdir (base_path )
173+ fs .touch (file_path , "wb" )
174+ assert fs .exists (file_path )
175+
176+
177+ def test_write_read_verify_file_with_equals (hdfs_cluster ):
178+ fs = WebHDFS (
179+ hdfs_cluster ,
180+ user = "testuser" ,
181+ data_proxy = {"worker.example.com" : "localhost" },
182+ )
183+ base_path = "/user/testuser/some_table/datestamp=2023-11-11"
184+ file_path = f"{ base_path } /testfile.txt"
185+ content = b"This is some content!"
186+
187+ fs .mkdir (base_path )
188+ with fs .open (file_path , "wb" ) as f :
189+ f .write (content )
190+
191+ with fs .open (file_path , "rb" ) as f :
192+ assert f .read () == content
193+
194+ file_info = fs .ls (base_path , detail = True )
195+ assert len (file_info ) == 1
196+ assert file_info [0 ]["name" ] == file_path
197+ assert file_info [0 ]["size" ] == len (content )
0 commit comments