Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Aug 29, 2022
1 parent d6636cf commit 2179760
Show file tree
Hide file tree
Showing 18 changed files with 720 additions and 9 deletions.
16 changes: 16 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,22 @@
# Automatically normalize the line endings of any committed text files:
* text=auto

# Override line endings for certain files on checkout:
*.crlf.csv text eol=crlf

# Denote that certain files are binary and should not be modified:
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.gz binary
*.zip binary
*.7z binary
*.mp3 binary
*.mp4 binary
*.mov binary

# Override what is considered "vendored" by GitHub's linguist:
/deps/** linguist-vendored=false
/lib/node_modules/** linguist-vendored=false linguist-generated=false
Expand Down
5 changes: 5 additions & 0 deletions dsv/base/parse/test/fixtures/crlf.crlf.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
a,b,c
1,2,3
"Once upon
a time",5,6
7,8,9
25 changes: 25 additions & 0 deletions dsv/base/parse/test/fixtures/crlf.crlf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"dsv": "a,b,c\r\n1,2,3\r\n\"Once upon \r\na time\",5,6\r\n7,8,9\r\n",
"json": [
[
"a",
"b",
"c"
],
[
"1",
"2",
"3"
],
[
"Once upon \r\na time",
"5",
"6"
],
[
"7",
"8",
"9"
]
]
}
24 changes: 24 additions & 0 deletions dsv/base/parse/test/fixtures/excel_copy_paste.crlf.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"CO2 emissions by different sub-groups in manufacturing sector, 2000 to 2007",,,,,,,,
thousand tonnes carbon equivalent,,,,,,,,
,,,,,,,,
Year,2000,2001,2002,2003,2004,2005,2006,2007
Timber,"2,666","2,274","1,877","1,999","2,055","1,632","1,687","1,751"
Other chemicals products,498,853,490,568,359,575,520,489
"Clay, ceramic and glass products","3,108","2,954","2,658","2,662","2,669","2,622","2,603","2,494"
Iron and steel,"22,927","20,744","18,010","20,650","21,018","20,820","21,680","22,002"
Other products,"1,611","2,261","1,655","2,008","1,879","1,834","1,728","1,706"
Recycling,577,604,714,416,416,679,422,392
Food and drink,"14,230","13,460","13,337","13,170","13,287","13,538","13,259","12,817"
Textiles,"4,497","4,236","4,155","4,074","3,856","3,940","3,728","3,556"
Chemicals,"20,725","19,251","20,041","18,491","18,963","18,109","17,449","16,683"
"Machinery and
equipment","27,173","26,708","25,690","25,204","24,888","25,600","25,421","25,128"
"Pulp, paper, publishing
and printing","4,666","5,859","5,659","6,133","5,871","5,838","5,382","5,176"
Rubber & plastic,"4,319","4,966","3,591","3,769","3,979","4,563","4,236","4,124"
"Cement, lime, concrete
and stones","13,525","12,874","12,653","12,268","12,208","11,852","12,162","12,292"
Total,"120,522","117,044","110,532","111,412","111,448","111,601","110,277","108,609"
,,,,,,,,
Source: Office for National Statistics.,,,,,,,,
"Note: includes emissions from electricity use, using a constant emission factor",,,,,,,,
4 changes: 4 additions & 0 deletions dsv/base/parse/test/fixtures/excel_copy_paste.crlf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"dsv": "\"CO2 emissions by different sub-groups in manufacturing sector, 2000 to 2007\",,,,,,,,\r\nthousand tonnes carbon equivalent,,,,,,,,\r\n,,,,,,,,\r\nYear,2000,2001,2002,2003,2004,2005,2006,2007\r\nTimber,\"2,666\",\"2,274\",\"1,877\",\"1,999\",\"2,055\",\"1,632\",\"1,687\",\"1,751\"\r\nOther chemicals products,498,853,490,568,359,575,520,489\r\n\"Clay, ceramic and glass products\",\"3,108\",\"2,954\",\"2,658\",\"2,662\",\"2,669\",\"2,622\",\"2,603\",\"2,494\"\r\nIron and steel,\"22,927\",\"20,744\",\"18,010\",\"20,650\",\"21,018\",\"20,820\",\"21,680\",\"22,002\"\r\nOther products,\"1,611\",\"2,261\",\"1,655\",\"2,008\",\"1,879\",\"1,834\",\"1,728\",\"1,706\"\r\nRecycling,577,604,714,416,416,679,422,392\r\nFood and drink,\"14,230\",\"13,460\",\"13,337\",\"13,170\",\"13,287\",\"13,538\",\"13,259\",\"12,817\"\r\nTextiles,\"4,497\",\"4,236\",\"4,155\",\"4,074\",\"3,856\",\"3,940\",\"3,728\",\"3,556\"\r\nChemicals,\"20,725\",\"19,251\",\"20,041\",\"18,491\",\"18,963\",\"18,109\",\"17,449\",\"16,683\"\r\n\"Machinery and \nequipment\",\"27,173\",\"26,708\",\"25,690\",\"25,204\",\"24,888\",\"25,600\",\"25,421\",\"25,128\"\r\n\"Pulp, paper, publishing\nand printing\",\"4,666\",\"5,859\",\"5,659\",\"6,133\",\"5,871\",\"5,838\",\"5,382\",\"5,176\"\r\nRubber & plastic,\"4,319\",\"4,966\",\"3,591\",\"3,769\",\"3,979\",\"4,563\",\"4,236\",\"4,124\"\r\n\"Cement, lime, concrete \nand stones\",\"13,525\",\"12,874\",\"12,653\",\"12,268\",\"12,208\",\"11,852\",\"12,162\",\"12,292\"\r\nTotal,\"120,522\",\"117,044\",\"110,532\",\"111,412\",\"111,448\",\"111,601\",\"110,277\",\"108,609\"\r\n,,,,,,,,\r\nSource: Office for National Statistics.,,,,,,,,\r\n\"Note: includes emissions from electricity use, using a constant emission factor\",,,,,,,,\r\n",
"json": []
}
151 changes: 151 additions & 0 deletions dsv/base/parse/test/fixtures/iris.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
sepal_length,sepal_width,petal_length,petal_width,species
5.1,3.5,1.4,0.2,Iris-setosa
4.9,3.0,1.4,0.2,Iris-setosa
4.7,3.2,1.3,0.2,Iris-setosa
4.6,3.1,1.5,0.2,Iris-setosa
5.0,3.6,1.4,0.2,Iris-setosa
5.4,3.9,1.7,0.4,Iris-setosa
4.6,3.4,1.4,0.3,Iris-setosa
5.0,3.4,1.5,0.2,Iris-setosa
4.4,2.9,1.4,0.2,Iris-setosa
4.9,3.1,1.5,0.1,Iris-setosa
5.4,3.7,1.5,0.2,Iris-setosa
4.8,3.4,1.6,0.2,Iris-setosa
4.8,3.0,1.4,0.1,Iris-setosa
4.3,3.0,1.1,0.1,Iris-setosa
5.8,4.0,1.2,0.2,Iris-setosa
5.7,4.4,1.5,0.4,Iris-setosa
5.4,3.9,1.3,0.4,Iris-setosa
5.1,3.5,1.4,0.3,Iris-setosa
5.7,3.8,1.7,0.3,Iris-setosa
5.1,3.8,1.5,0.3,Iris-setosa
5.4,3.4,1.7,0.2,Iris-setosa
5.1,3.7,1.5,0.4,Iris-setosa
4.6,3.6,1.0,0.2,Iris-setosa
5.1,3.3,1.7,0.5,Iris-setosa
4.8,3.4,1.9,0.2,Iris-setosa
5.0,3.0,1.6,0.2,Iris-setosa
5.0,3.4,1.6,0.4,Iris-setosa
5.2,3.5,1.5,0.2,Iris-setosa
5.2,3.4,1.4,0.2,Iris-setosa
4.7,3.2,1.6,0.2,Iris-setosa
4.8,3.1,1.6,0.2,Iris-setosa
5.4,3.4,1.5,0.4,Iris-setosa
5.2,4.1,1.5,0.1,Iris-setosa
5.5,4.2,1.4,0.2,Iris-setosa
4.9,3.1,1.5,0.2,Iris-setosa
5.0,3.2,1.2,0.2,Iris-setosa
5.5,3.5,1.3,0.2,Iris-setosa
4.9,3.6,1.4,0.1,Iris-setosa
4.4,3.0,1.3,0.2,Iris-setosa
5.1,3.4,1.5,0.2,Iris-setosa
5.0,3.5,1.3,0.3,Iris-setosa
4.5,2.3,1.3,0.3,Iris-setosa
4.4,3.2,1.3,0.2,Iris-setosa
5.0,3.5,1.6,0.6,Iris-setosa
5.1,3.8,1.9,0.4,Iris-setosa
4.8,3.0,1.4,0.3,Iris-setosa
5.1,3.8,1.6,0.2,Iris-setosa
4.6,3.2,1.4,0.2,Iris-setosa
5.3,3.7,1.5,0.2,Iris-setosa
5.0,3.3,1.4,0.2,Iris-setosa
7.0,3.2,4.7,1.4,Iris-versicolor
6.4,3.2,4.5,1.5,Iris-versicolor
6.9,3.1,4.9,1.5,Iris-versicolor
5.5,2.3,4.0,1.3,Iris-versicolor
6.5,2.8,4.6,1.5,Iris-versicolor
5.7,2.8,4.5,1.3,Iris-versicolor
6.3,3.3,4.7,1.6,Iris-versicolor
4.9,2.4,3.3,1.0,Iris-versicolor
6.6,2.9,4.6,1.3,Iris-versicolor
5.2,2.7,3.9,1.4,Iris-versicolor
5.0,2.0,3.5,1.0,Iris-versicolor
5.9,3.0,4.2,1.5,Iris-versicolor
6.0,2.2,4.0,1.0,Iris-versicolor
6.1,2.9,4.7,1.4,Iris-versicolor
5.6,2.9,3.6,1.3,Iris-versicolor
6.7,3.1,4.4,1.4,Iris-versicolor
5.6,3.0,4.5,1.5,Iris-versicolor
5.8,2.7,4.1,1.0,Iris-versicolor
6.2,2.2,4.5,1.5,Iris-versicolor
5.6,2.5,3.9,1.1,Iris-versicolor
5.9,3.2,4.8,1.8,Iris-versicolor
6.1,2.8,4.0,1.3,Iris-versicolor
6.3,2.5,4.9,1.5,Iris-versicolor
6.1,2.8,4.7,1.2,Iris-versicolor
6.4,2.9,4.3,1.3,Iris-versicolor
6.6,3.0,4.4,1.4,Iris-versicolor
6.8,2.8,4.8,1.4,Iris-versicolor
6.7,3.0,5.0,1.7,Iris-versicolor
6.0,2.9,4.5,1.5,Iris-versicolor
5.7,2.6,3.5,1.0,Iris-versicolor
5.5,2.4,3.8,1.1,Iris-versicolor
5.5,2.4,3.7,1.0,Iris-versicolor
5.8,2.7,3.9,1.2,Iris-versicolor
6.0,2.7,5.1,1.6,Iris-versicolor
5.4,3.0,4.5,1.5,Iris-versicolor
6.0,3.4,4.5,1.6,Iris-versicolor
6.7,3.1,4.7,1.5,Iris-versicolor
6.3,2.3,4.4,1.3,Iris-versicolor
5.6,3.0,4.1,1.3,Iris-versicolor
5.5,2.5,4.0,1.3,Iris-versicolor
5.5,2.6,4.4,1.2,Iris-versicolor
6.1,3.0,4.6,1.4,Iris-versicolor
5.8,2.6,4.0,1.2,Iris-versicolor
5.0,2.3,3.3,1.0,Iris-versicolor
5.6,2.7,4.2,1.3,Iris-versicolor
5.7,3.0,4.2,1.2,Iris-versicolor
5.7,2.9,4.2,1.3,Iris-versicolor
6.2,2.9,4.3,1.3,Iris-versicolor
5.1,2.5,3.0,1.1,Iris-versicolor
5.7,2.8,4.1,1.3,Iris-versicolor
6.3,3.3,6.0,2.5,Iris-virginica
5.8,2.7,5.1,1.9,Iris-virginica
7.1,3.0,5.9,2.1,Iris-virginica
6.3,2.9,5.6,1.8,Iris-virginica
6.5,3.0,5.8,2.2,Iris-virginica
7.6,3.0,6.6,2.1,Iris-virginica
4.9,2.5,4.5,1.7,Iris-virginica
7.3,2.9,6.3,1.8,Iris-virginica
6.7,2.5,5.8,1.8,Iris-virginica
7.2,3.6,6.1,2.5,Iris-virginica
6.5,3.2,5.1,2.0,Iris-virginica
6.4,2.7,5.3,1.9,Iris-virginica
6.8,3.0,5.5,2.1,Iris-virginica
5.7,2.5,5.0,2.0,Iris-virginica
5.8,2.8,5.1,2.4,Iris-virginica
6.4,3.2,5.3,2.3,Iris-virginica
6.5,3.0,5.5,1.8,Iris-virginica
7.7,3.8,6.7,2.2,Iris-virginica
7.7,2.6,6.9,2.3,Iris-virginica
6.0,2.2,5.0,1.5,Iris-virginica
6.9,3.2,5.7,2.3,Iris-virginica
5.6,2.8,4.9,2.0,Iris-virginica
7.7,2.8,6.7,2.0,Iris-virginica
6.3,2.7,4.9,1.8,Iris-virginica
6.7,3.3,5.7,2.1,Iris-virginica
7.2,3.2,6.0,1.8,Iris-virginica
6.2,2.8,4.8,1.8,Iris-virginica
6.1,3.0,4.9,1.8,Iris-virginica
6.4,2.8,5.6,2.1,Iris-virginica
7.2,3.0,5.8,1.6,Iris-virginica
7.4,2.8,6.1,1.9,Iris-virginica
7.9,3.8,6.4,2.0,Iris-virginica
6.4,2.8,5.6,2.2,Iris-virginica
6.3,2.8,5.1,1.5,Iris-virginica
6.1,2.6,5.6,1.4,Iris-virginica
7.7,3.0,6.1,2.3,Iris-virginica
6.3,3.4,5.6,2.4,Iris-virginica
6.4,3.1,5.5,1.8,Iris-virginica
6.0,3.0,4.8,1.8,Iris-virginica
6.9,3.1,5.4,2.1,Iris-virginica
6.7,3.1,5.6,2.4,Iris-virginica
6.9,3.1,5.1,2.3,Iris-virginica
5.8,2.7,5.1,1.9,Iris-virginica
6.8,3.2,5.9,2.3,Iris-virginica
6.7,3.3,5.7,2.5,Iris-virginica
6.7,3.0,5.2,2.3,Iris-virginica
6.3,2.5,5.0,1.9,Iris-virginica
6.5,3.0,5.2,2.0,Iris-virginica
6.2,3.4,5.4,2.3,Iris-virginica
5.9,3.0,5.1,1.8,Iris-virginica
4 changes: 4 additions & 0 deletions dsv/base/parse/test/fixtures/iris.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"dsv": "sepal_length,sepal_width,petal_length,petal_width,species\n5.1,3.5,1.4,0.2,Iris-setosa\n4.9,3.0,1.4,0.2,Iris-setosa\n4.7,3.2,1.3,0.2,Iris-setosa\n4.6,3.1,1.5,0.2,Iris-setosa\n5.0,3.6,1.4,0.2,Iris-setosa\n5.4,3.9,1.7,0.4,Iris-setosa\n4.6,3.4,1.4,0.3,Iris-setosa\n5.0,3.4,1.5,0.2,Iris-setosa\n4.4,2.9,1.4,0.2,Iris-setosa\n4.9,3.1,1.5,0.1,Iris-setosa\n5.4,3.7,1.5,0.2,Iris-setosa\n4.8,3.4,1.6,0.2,Iris-setosa\n4.8,3.0,1.4,0.1,Iris-setosa\n4.3,3.0,1.1,0.1,Iris-setosa\n5.8,4.0,1.2,0.2,Iris-setosa\n5.7,4.4,1.5,0.4,Iris-setosa\n5.4,3.9,1.3,0.4,Iris-setosa\n5.1,3.5,1.4,0.3,Iris-setosa\n5.7,3.8,1.7,0.3,Iris-setosa\n5.1,3.8,1.5,0.3,Iris-setosa\n5.4,3.4,1.7,0.2,Iris-setosa\n5.1,3.7,1.5,0.4,Iris-setosa\n4.6,3.6,1.0,0.2,Iris-setosa\n5.1,3.3,1.7,0.5,Iris-setosa\n4.8,3.4,1.9,0.2,Iris-setosa\n5.0,3.0,1.6,0.2,Iris-setosa\n5.0,3.4,1.6,0.4,Iris-setosa\n5.2,3.5,1.5,0.2,Iris-setosa\n5.2,3.4,1.4,0.2,Iris-setosa\n4.7,3.2,1.6,0.2,Iris-setosa\n4.8,3.1,1.6,0.2,Iris-setosa\n5.4,3.4,1.5,0.4,Iris-setosa\n5.2,4.1,1.5,0.1,Iris-setosa\n5.5,4.2,1.4,0.2,Iris-setosa\n4.9,3.1,1.5,0.2,Iris-setosa\n5.0,3.2,1.2,0.2,Iris-setosa\n5.5,3.5,1.3,0.2,Iris-setosa\n4.9,3.6,1.4,0.1,Iris-setosa\n4.4,3.0,1.3,0.2,Iris-setosa\n5.1,3.4,1.5,0.2,Iris-setosa\n5.0,3.5,1.3,0.3,Iris-setosa\n4.5,2.3,1.3,0.3,Iris-setosa\n4.4,3.2,1.3,0.2,Iris-setosa\n5.0,3.5,1.6,0.6,Iris-setosa\n5.1,3.8,1.9,0.4,Iris-setosa\n4.8,3.0,1.4,0.3,Iris-setosa\n5.1,3.8,1.6,0.2,Iris-setosa\n4.6,3.2,1.4,0.2,Iris-setosa\n5.3,3.7,1.5,0.2,Iris-setosa\n5.0,3.3,1.4,0.2,Iris-setosa\n7.0,3.2,4.7,1.4,Iris-versicolor\n6.4,3.2,4.5,1.5,Iris-versicolor\n6.9,3.1,4.9,1.5,Iris-versicolor\n5.5,2.3,4.0,1.3,Iris-versicolor\n6.5,2.8,4.6,1.5,Iris-versicolor\n5.7,2.8,4.5,1.3,Iris-versicolor\n6.3,3.3,4.7,1.6,Iris-versicolor\n4.9,2.4,3.3,1.0,Iris-versicolor\n6.6,2.9,4.6,1.3,Iris-versicolor\n5.2,2.7,3.9,1.4,Iris-versicolor\n5.0,2.0,3.5,1.0,Iris-versicolor\n5.9,3.0,4.2,1.5,Iris-versicolor\n6.0,2.2,4.0,1.0,Iris-versicolor\n6.1,2.9,4.7,1.4,Iris-versicolor\n5.6,2.9,3.6,1.3,Iris-versicolor\n6.7,3.1,4.4,1.4,Iris-versicolor\n5.6,3.0,4.5,1.5,Iris-versicolor\n5.8,2.7,4.1,1.0,Iris-versicolor\n6.2,2.2,4.5,1.5,Iris-versicolor\n5.6,2.5,3.9,1.1,Iris-versicolor\n5.9,3.2,4.8,1.8,Iris-versicolor\n6.1,2.8,4.0,1.3,Iris-versicolor\n6.3,2.5,4.9,1.5,Iris-versicolor\n6.1,2.8,4.7,1.2,Iris-versicolor\n6.4,2.9,4.3,1.3,Iris-versicolor\n6.6,3.0,4.4,1.4,Iris-versicolor\n6.8,2.8,4.8,1.4,Iris-versicolor\n6.7,3.0,5.0,1.7,Iris-versicolor\n6.0,2.9,4.5,1.5,Iris-versicolor\n5.7,2.6,3.5,1.0,Iris-versicolor\n5.5,2.4,3.8,1.1,Iris-versicolor\n5.5,2.4,3.7,1.0,Iris-versicolor\n5.8,2.7,3.9,1.2,Iris-versicolor\n6.0,2.7,5.1,1.6,Iris-versicolor\n5.4,3.0,4.5,1.5,Iris-versicolor\n6.0,3.4,4.5,1.6,Iris-versicolor\n6.7,3.1,4.7,1.5,Iris-versicolor\n6.3,2.3,4.4,1.3,Iris-versicolor\n5.6,3.0,4.1,1.3,Iris-versicolor\n5.5,2.5,4.0,1.3,Iris-versicolor\n5.5,2.6,4.4,1.2,Iris-versicolor\n6.1,3.0,4.6,1.4,Iris-versicolor\n5.8,2.6,4.0,1.2,Iris-versicolor\n5.0,2.3,3.3,1.0,Iris-versicolor\n5.6,2.7,4.2,1.3,Iris-versicolor\n5.7,3.0,4.2,1.2,Iris-versicolor\n5.7,2.9,4.2,1.3,Iris-versicolor\n6.2,2.9,4.3,1.3,Iris-versicolor\n5.1,2.5,3.0,1.1,Iris-versicolor\n5.7,2.8,4.1,1.3,Iris-versicolor\n6.3,3.3,6.0,2.5,Iris-virginica\n5.8,2.7,5.1,1.9,Iris-virginica\n7.1,3.0,5.9,2.1,Iris-virginica\n6.3,2.9,5.6,1.8,Iris-virginica\n6.5,3.0,5.8,2.2,Iris-virginica\n7.6,3.0,6.6,2.1,Iris-virginica\n4.9,2.5,4.5,1.7,Iris-virginica\n7.3,2.9,6.3,1.8,Iris-virginica\n6.7,2.5,5.8,1.8,Iris-virginica\n7.2,3.6,6.1,2.5,Iris-virginica\n6.5,3.2,5.1,2.0,Iris-virginica\n6.4,2.7,5.3,1.9,Iris-virginica\n6.8,3.0,5.5,2.1,Iris-virginica\n5.7,2.5,5.0,2.0,Iris-virginica\n5.8,2.8,5.1,2.4,Iris-virginica\n6.4,3.2,5.3,2.3,Iris-virginica\n6.5,3.0,5.5,1.8,Iris-virginica\n7.7,3.8,6.7,2.2,Iris-virginica\n7.7,2.6,6.9,2.3,Iris-virginica\n6.0,2.2,5.0,1.5,Iris-virginica\n6.9,3.2,5.7,2.3,Iris-virginica\n5.6,2.8,4.9,2.0,Iris-virginica\n7.7,2.8,6.7,2.0,Iris-virginica\n6.3,2.7,4.9,1.8,Iris-virginica\n6.7,3.3,5.7,2.1,Iris-virginica\n7.2,3.2,6.0,1.8,Iris-virginica\n6.2,2.8,4.8,1.8,Iris-virginica\n6.1,3.0,4.9,1.8,Iris-virginica\n6.4,2.8,5.6,2.1,Iris-virginica\n7.2,3.0,5.8,1.6,Iris-virginica\n7.4,2.8,6.1,1.9,Iris-virginica\n7.9,3.8,6.4,2.0,Iris-virginica\n6.4,2.8,5.6,2.2,Iris-virginica\n6.3,2.8,5.1,1.5,Iris-virginica\n6.1,2.6,5.6,1.4,Iris-virginica\n7.7,3.0,6.1,2.3,Iris-virginica\n6.3,3.4,5.6,2.4,Iris-virginica\n6.4,3.1,5.5,1.8,Iris-virginica\n6.0,3.0,4.8,1.8,Iris-virginica\n6.9,3.1,5.4,2.1,Iris-virginica\n6.7,3.1,5.6,2.4,Iris-virginica\n6.9,3.1,5.1,2.3,Iris-virginica\n5.8,2.7,5.1,1.9,Iris-virginica\n6.8,3.2,5.9,2.3,Iris-virginica\n6.7,3.3,5.7,2.5,Iris-virginica\n6.7,3.0,5.2,2.3,Iris-virginica\n6.3,2.5,5.0,1.9,Iris-virginica\n6.5,3.0,5.2,2.0,Iris-virginica\n6.2,3.4,5.4,2.3,Iris-virginica\n5.9,3.0,5.1,1.8,Iris-virginica",
"json": []
}
8 changes: 4 additions & 4 deletions dsv/base/parse/test/fixtures/quoted_field_with_escape.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"\"a\"",b,c
1,"a \"b\" c",2
3,"\"\"",4
5,6,"\"7\""
"\\a\\",b,c
1,"a \\b\\ c",2
3,"\\\\",4
5,6,"\\7\\"
10 changes: 5 additions & 5 deletions dsv/base/parse/test/fixtures/quoted_field_with_escape.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
{
"dsv": "\"\\\"a\\\"\",b,c\n1,\"a \\\"b\\\" c\",2\n3,\"\\\"\\\"\",4\n5,6,\"\\\"7\\\"\"\n",
"dsv": "\"\\\\a\\\\\",b,c\n1,\"a \\\\b\\\\ c\",2\n3,\"\\\\\\\\\",4\n5,6,\"\\\\7\\\\\"\n",
"json": [
[
"\"a\"",
"\\\\a\\\\",
"b",
"c"
],
[
"1",
"a \"b\" c",
"a \\\\b\\\\ c",
"2"
],
[
"3",
"\"\"",
"\\\\\\\\",
"4"
],
[
"5",
"6",
"\"7\""
"\\\\7\\\\"
]
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"\"a\"",b,c
1,"a \"b\" c",2
3,"\"\"",4
5,6,"\"7\""
25 changes: 25 additions & 0 deletions dsv/base/parse/test/fixtures/quoted_field_with_escaped_quote.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"dsv": "\"\\\"a\\\"\",b,c\n1,\"a \\\"b\\\" c\",2\n3,\"\\\"\\\"\",4\n5,6,\"\\\"7\\\"\"\n",
"json": [
[
"\"a\"",
"b",
"c"
],
[
"1",
"a \"b\" c",
"2"
],
[
"3",
"\"\"",
"4"
],
[
"5",
"6",
"\"7\""
]
]
}
66 changes: 66 additions & 0 deletions dsv/base/parse/test/test.crlf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2022 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

// MODULES //

var tape = require( 'tape' );
var Parser = require( './../lib' );


// FIXTURES //

var fixture = require( './fixtures/crlf.crlf.json' );


// TESTS //

tape( 'main export is a function', function test( t ) {
t.ok( true, __filename );
t.equal( typeof Parser, 'function', 'main export is a function' );
t.end();
});

tape( 'the parser successfully parses DSV containing CRLF row separators', function test( t ) {
var expected;
var flg;
var p;
var i;

expected = fixture.json;
i = 0;

p = new Parser({
'newline': '\r\n',
'onRow': onRow,
'onClose': onClose
});
p.next( fixture.dsv ).close();

function onRow( record, row ) {
flg = true;
t.deepEqual( record, expected[ i ], 'returns expected value. Row: '+row+'.' );
i += 1;
}

function onClose() {
t.ok( flg, 'parses rows' );
t.end();
}
});
Loading

0 comments on commit 2179760

Please sign in to comment.