File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
src/datasets/packaged_modules Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,8 @@ def _hash_python_lines(lines: List[str]) -> str:
61
61
".tsv" : ("csv" , {"sep" : "\t " }),
62
62
".json" : ("json" , {}),
63
63
".jsonl" : ("json" , {}),
64
+ # ndjson is no longer maintained (see: https://github.com/ndjson/ndjson-spec/issues/35#issuecomment-1285673417)
65
+ ".ndjson" : ("json" , {}),
64
66
".parquet" : ("parquet" , {}),
65
67
".geoparquet" : ("parquet" , {}),
66
68
".gpq" : ("parquet" , {}),
Original file line number Diff line number Diff line change @@ -24,6 +24,22 @@ def jsonl_file(tmp_path):
24
24
return str (filename )
25
25
26
26
27
+ # ndjson format is no longer maintained (see: https://github.com/ndjson/ndjson-spec/issues/35#issuecomment-1285673417)
28
+ @pytest .fixture
29
+ def ndjson_file (tmp_path ):
30
+ filename = tmp_path / "file.ndjson"
31
+ data = textwrap .dedent (
32
+ """\
33
+ {"col_1": -1}
34
+ {"col_1": 1, "col_2": 2}
35
+ {"col_1": 10, "col_2": 20}
36
+ """
37
+ )
38
+ with open (filename , "w" ) as f :
39
+ f .write (data )
40
+ return str (filename )
41
+
42
+
27
43
@pytest .fixture
28
44
def jsonl_file_utf16_encoded (tmp_path ):
29
45
filename = tmp_path / "file_utf16_encoded.jsonl"
@@ -188,6 +204,7 @@ def test_config_raises_when_invalid_data_files(data_files) -> None:
188
204
"file_fixture, config_kwargs" ,
189
205
[
190
206
("jsonl_file" , {}),
207
+ ("ndjson_file" , {}),
191
208
("jsonl_file_utf16_encoded" , {"encoding" : "utf-16" }),
192
209
("json_file_with_list_of_dicts" , {}),
193
210
("json_file_with_list_of_dicts_field" , {"field" : "field3" }),
You can’t perform that action at this time.
0 commit comments