@@ -1081,15 +1081,15 @@ add_specs suite_builder =
10811081 r2.column_names . should_equal ["Path", "Sheet Name", "A", "B", "C"]
10821082
10831083 # We transform the Path to just file name for easier testing
1084- rows = (r2.set (r2.at "Path" . map .name) "Path") .rows.map .to_vector
1085- rows.at 0 . should_equal ["1.tsv", Nothing, 1, 3, Nothing]
1086- rows.at 1 . should_equal ["1.tsv", Nothing, 2, 4, Nothing]
1087- rows.at 2 . should_equal ["2.xlsx", "EnsoSheet", 10, 30, Nothing]
1088- rows.at 3 . should_equal ["2.xlsx", "EnsoSheet", 20, 40, Nothing]
1089- rows.at 4 . should_equal ["3.xlsx", "nr 1", 100, 200, 300]
1090- rows.at 5 . should_equal ["3.xlsx", "nr 2", 400, Nothing, Nothing]
1091- rows.at 6 . should_equal ["3.xlsx", "nr 2", 500, Nothing, Nothing]
1092- rows.at 7 . should_equal ["3.xlsx", "nr 2", 600, Nothing, Nothing]
1084+ rows = r2 .rows.map .to_vector
1085+ rows.at 0 . should_equal [(base_dir / "1.tsv") . path , Nothing, 1, 3, Nothing]
1086+ rows.at 1 . should_equal [(base_dir / "1.tsv") . path , Nothing, 2, 4, Nothing]
1087+ rows.at 2 . should_equal [(base_dir / "2.xlsx") . path , "EnsoSheet", 10, 30, Nothing]
1088+ rows.at 3 . should_equal [(base_dir / "2.xlsx") . path , "EnsoSheet", 20, 40, Nothing]
1089+ rows.at 4 . should_equal [(base_dir / "3.xlsx") . path , "nr 1", 100, 200, 300]
1090+ rows.at 5 . should_equal [(base_dir / "3.xlsx") . path , "nr 2", 400, Nothing, Nothing]
1091+ rows.at 6 . should_equal [(base_dir / "3.xlsx") . path , "nr 2", 500, Nothing, Nothing]
1092+ rows.at 7 . should_equal [(base_dir / "3.xlsx") . path , "nr 2", 600, Nothing, Nothing]
10931093
10941094 # Test loading only Excel files and alternate matching mode to weed out edge cases
10951095 r3 = Data.read_many (Data.list base_dir name_filter="*.xlsx" . sort on=(.name)) return=..As_Merged_Table
@@ -1115,56 +1115,56 @@ add_specs suite_builder =
11151115 r1.should_be_a Table
11161116 within_table r1 <|
11171117 # We transform the Path to just file name for easier testing
1118- rows = (r1.set (r1.at "Path" . map .name) "Path") .rows.map .to_vector
1118+ rows = r1 .rows.map .to_vector
11191119
11201120 # Each Sheet Name column comes out as separate: 1 - input, 2 - metadata, 3 - data
11211121 # The order of columns is as they appear in the input, and they are matched by name
11221122 r1.column_names . should_equal [ "Path", "Sheet Name", "Sheet Name 1", "Z", "Sheet Name 2", "X", "Y"]
1123- rows.at 0 . should_equal [ "1.tsv", "input 1", Nothing, 1, "data column", Nothing, Nothing]
1124- rows.at 1 . should_equal [ "1.tsv", "input 1", Nothing, 2, "data column", Nothing, Nothing]
1125- rows.at 2 . should_equal ["2.xlsx", "input 2", "EnsoSheet", 10, Nothing, 20, Nothing]
1126- rows.at 3 . should_equal ["3.xlsx", "input 3", "nr 1", 300, Nothing, 100, 200]
1127- rows.at 4 . should_equal ["3.xlsx", "input 3", "nr 2", Nothing, "400", Nothing, Nothing]
1128- rows.at 5 . should_equal ["3.xlsx", "input 3", "nr 2", Nothing, "500", Nothing, Nothing]
1129- rows.at 6 . should_equal ["3.xlsx", "input 3", "nr 2", Nothing, "600", Nothing, Nothing]
1123+ rows.at 0 . should_equal [(base_dir / "1.tsv").path , "input 1", Nothing, 1, "data column", Nothing, Nothing]
1124+ rows.at 1 . should_equal [(base_dir / "1.tsv").path , "input 1", Nothing, 2, "data column", Nothing, Nothing]
1125+ rows.at 2 . should_equal [(base_dir / "2.xlsx").path , "input 2", "EnsoSheet", 10, Nothing, 20, Nothing]
1126+ rows.at 3 . should_equal [(base_dir / "3.xlsx").path , "input 3", "nr 1", 300, Nothing, 100, 200]
1127+ rows.at 4 . should_equal [(base_dir / "3.xlsx").path , "input 3", "nr 2", Nothing, "400", Nothing, Nothing]
1128+ rows.at 5 . should_equal [(base_dir / "3.xlsx").path , "input 3", "nr 2", Nothing, "500", Nothing, Nothing]
1129+ rows.at 6 . should_equal [(base_dir / "3.xlsx").path , "input 3", "nr 2", Nothing, "600", Nothing, Nothing]
11301130
11311131 Problems.expect_warning Duplicate_Output_Column_Names r1
11321132 Problems.expect_warning No_Common_Type r1
11331133
11341134 r2 = Data.read_many input return=(..As_Merged_Table match=..By_Position)
11351135 r2.should_be_a Table
11361136 within_table r2 <|
1137- rows = (r2.set (r2.at "Path" . map .name) "Path") .rows.map .to_vector
1137+ rows = r2 .rows.map .to_vector
11381138
11391139 # Two Sheet Name column comes out as separate: 1 - input, 2 - metadata, the third one (data) gets renamed due to positional matching
11401140 # The column names come from the first table that had all the columns - in this case, first sheet of 3.xlsx
11411141 r2.column_names . should_equal [ "Path", "Sheet Name", "Sheet Name 1", "X", "Y", "Z"]
1142- rows.at 0 . should_equal [ "1.tsv", "input 1", Nothing, 1, "data column", Nothing]
1143- rows.at 1 . should_equal [ "1.tsv", "input 1", Nothing, 2, "data column", Nothing]
1144- rows.at 2 . should_equal ["2.xlsx", "input 2", "EnsoSheet", 10, "20", Nothing]
1145- rows.at 3 . should_equal ["3.xlsx", "input 3", "nr 1", 100, "200", 300]
1146- rows.at 4 . should_equal ["3.xlsx", "input 3", "nr 2", 400, Nothing, Nothing]
1147- rows.at 5 . should_equal ["3.xlsx", "input 3", "nr 2", 500, Nothing, Nothing]
1148- rows.at 6 . should_equal ["3.xlsx", "input 3", "nr 2", 600, Nothing, Nothing]
1142+ rows.at 0 . should_equal [(base_dir / "1.tsv").path , "input 1", Nothing, 1, "data column", Nothing]
1143+ rows.at 1 . should_equal [(base_dir / "1.tsv").path , "input 1", Nothing, 2, "data column", Nothing]
1144+ rows.at 2 . should_equal [(base_dir / "2.xlsx").path , "input 2", "EnsoSheet", 10, "20", Nothing]
1145+ rows.at 3 . should_equal [(base_dir / "3.xlsx").path , "input 3", "nr 1", 100, "200", 300]
1146+ rows.at 4 . should_equal [(base_dir / "3.xlsx").path , "input 3", "nr 2", 400, Nothing, Nothing]
1147+ rows.at 5 . should_equal [(base_dir / "3.xlsx").path , "input 3", "nr 2", 500, Nothing, Nothing]
1148+ rows.at 6 . should_equal [(base_dir / "3.xlsx").path , "input 3", "nr 2", 600, Nothing, Nothing]
11491149
11501150 Problems.expect_warning Duplicate_Output_Column_Names r2
11511151 Problems.expect_warning No_Common_Type r2
11521152
11531153 r3 = Data.read_many input return=(..As_Merged_Table columns_to_keep=..In_All match=..By_Position)
11541154 r3.should_be_a Table
11551155 within_table r3 <|
1156- rows = (r3.set (r3.at "Path" . map .name) "Path") .rows.map .to_vector
1156+ rows = r3 .rows.map .to_vector
11571157
11581158 # Same as with `r2`, but now we keep only columns that are present in all tables, then the column names come from the first table (so we get column Z).
11591159 # But the `Sheet Name` metadata column is still kept, as its matching is independent of data.
11601160 r3.column_names . should_equal [ "Path", "Sheet Name", "Sheet Name 1", "Z"]
1161- rows.at 0 . should_equal [ "1.tsv", "input 1", Nothing, 1]
1162- rows.at 1 . should_equal [ "1.tsv", "input 1", Nothing, 2]
1163- rows.at 2 . should_equal ["2.xlsx", "input 2", "EnsoSheet", 10]
1164- rows.at 3 . should_equal ["3.xlsx", "input 3", "nr 1", 100]
1165- rows.at 4 . should_equal ["3.xlsx", "input 3", "nr 2", 400]
1166- rows.at 5 . should_equal ["3.xlsx", "input 3", "nr 2", 500]
1167- rows.at 6 . should_equal ["3.xlsx", "input 3", "nr 2", 600]
1161+ rows.at 0 . should_equal [(base_dir / "1.tsv").path , "input 1", Nothing, 1]
1162+ rows.at 1 . should_equal [(base_dir / "1.tsv").path , "input 1", Nothing, 2]
1163+ rows.at 2 . should_equal [(base_dir / "2.xlsx").path , "input 2", "EnsoSheet", 10]
1164+ rows.at 3 . should_equal [(base_dir / "3.xlsx").path , "input 3", "nr 1", 100]
1165+ rows.at 4 . should_equal [(base_dir / "3.xlsx").path , "input 3", "nr 2", 400]
1166+ rows.at 5 . should_equal [(base_dir / "3.xlsx").path , "input 3", "nr 2", 500]
1167+ rows.at 6 . should_equal [(base_dir / "3.xlsx").path , "input 3", "nr 2", 600]
11681168
11691169 Problems.expect_warning Duplicate_Output_Column_Names r3
11701170 Problems.expect_warning Column_Count_Mismatch r3
@@ -1180,8 +1180,8 @@ add_specs suite_builder =
11801180 r.row_count . should_equal 2+25
11811181 r.column_names . should_equal ["Path", "Sheet Name", "A", "B", "Name", "Quantity", "Price", "C", "D", "E", "Student Name", "Enrolment Date", "Item", "Price 1"]
11821182 # First two rows come from TSV, the rest from Excel sheets
1183- r.at "Path" . to_vector . map .name . should_equal <|
1184- (Vector.fill 2 tsv_file.name ) + (Vector.fill 25 xls_file.name )
1183+ r.at "Path" . to_vector . should_equal <|
1184+ (Vector.fill 2 tsv_file.path ) + (Vector.fill 25 xls_file.path )
11851185 r.at "Sheet Name" . to_vector . should_equal <|
11861186 (Vector.fill 2 Nothing) + (Vector.fill 6 "Simple") + (Vector.fill 7 "Strange Dimensions") + (Vector.fill 6 "Dates") + (Vector.fill 6 "Duplicate Columns")
11871187
@@ -1203,7 +1203,7 @@ add_specs suite_builder =
12031203 # But when not expanding rows, the workbook with all-empty sheets is normally loaded into a cell
12041204 r3 = Data.read_many [tsv_file, empty_xls_file] return=..With_New_Column
12051205 r3.should_be_a Table
1206- r3.at "Path" . to_vector . map .name . should_equal [tsv_file.name , empty_xls_file.name ]
1206+ r3.at "Path" . to_vector . should_equal [tsv_file.path , empty_xls_file.path ]
12071207 r3.at "Value" . at 0 . should_be_a Table
12081208 r3.at "Value" . at 1 . should_be_a Excel_Workbook
12091209
0 commit comments