Skip to content

Commit ee3bd9b

Browse files
committed
fix csv file qa tests
1 parent 3ea0f79 commit ee3bd9b

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

py/desidatamodel/stub.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -713,15 +713,15 @@ def read_column_descriptions(filename):
713713

714714
with open(filename) as fp:
715715
header = fp.readline().strip()
716-
correct_header = 'Name,Type,Units,Description'
716+
correct_header = 'Name,Type,Units,FullDescription,Description'
717717
if header != correct_header:
718-
raise ValueError(f'{filename} header {header} should be {correct_header}')
718+
raise ValueError(f'{filename} header {header} should be {correct_header}.')
719719

720720
coldesc = dict()
721721
csvreader = csv.reader(fp)
722722
for row in csvreader:
723-
name, dtype, units, desc = row
724-
coldesc[name] = dict(Type=dtype, Units=units, Description=desc)
723+
name, dtype, units, dm_desc, fits_desc = row
724+
coldesc[name] = dict(Type=dtype, Units=units, Description=dm_desc)
725725

726726
return coldesc
727727

Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Name,Type,Units,Description
2-
target,char[20],,Target Name
3-
V_mag,float32,nanomaggy,V-band nanomaggy to test units
4-
vdisp,float64,m/s,Velocity dispersion
1+
Name,Type,Units,FullDescription,Description
2+
target,char[20],,Target Name,Target Name
3+
V_mag,float32,nanomaggy,V-band nanomaggy to test units,V-band flux
4+
vdisp,float64,m/s,Velocity dispersion,Vel Disp

py/desidatamodel/test/test_stub.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,10 @@ def test_Stub_with_descriptions(self, mock_log):
685685

686686
# incorrect format column description file
687687
baddescfile = self.test_files / 'bad_column_descriptions.csv'
688-
with self.assertRaises(ValueError):
688+
header = 'Name,dtype,Units,Description'
689+
correct_header = 'Name,Type,Units,FullDescription,Description'
690+
with self.assertRaises(ValueError) as exc:
689691
stub = Stub(filename, description_file=baddescfile)
690692
lines = str(stub)
693+
self.assertEqual(exc.exception.args[0],
694+
f'{str(baddescfile)} header {header} should be {correct_header}.')

0 commit comments

Comments
 (0)