diff --git a/py/desidatamodel/stub.py b/py/desidatamodel/stub.py index 7cdd1b80..18f13a41 100644 --- a/py/desidatamodel/stub.py +++ b/py/desidatamodel/stub.py @@ -713,15 +713,15 @@ def read_column_descriptions(filename): with open(filename) as fp: header = fp.readline().strip() - correct_header = 'Name,Type,Units,Description' + correct_header = 'Name,Type,Units,FullDescription,Description' if header != correct_header: - raise ValueError(f'{filename} header {header} should be {correct_header}') + raise ValueError(f'{filename} header {header} should be {correct_header}.') coldesc = dict() csvreader = csv.reader(fp) for row in csvreader: - name, dtype, units, desc = row - coldesc[name] = dict(Type=dtype, Units=units, Description=desc) + name, dtype, units, dm_desc, fits_desc = row + coldesc[name] = dict(Type=dtype, Units=units, Description=dm_desc) return coldesc diff --git a/py/desidatamodel/test/t/column_descriptions.csv b/py/desidatamodel/test/t/column_descriptions.csv index 44d2d199..2fec875f 100644 --- a/py/desidatamodel/test/t/column_descriptions.csv +++ b/py/desidatamodel/test/t/column_descriptions.csv @@ -1,4 +1,4 @@ -Name,Type,Units,Description -target,char[20],,Target Name -V_mag,float32,nanomaggy,V-band nanomaggy to test units -vdisp,float64,m/s,Velocity dispersion +Name,Type,Units,FullDescription,Description +target,char[20],,Target Name,Target Name +V_mag,float32,nanomaggy,V-band nanomaggy to test units,V-band flux +vdisp,float64,m/s,Velocity dispersion,Vel Disp diff --git a/py/desidatamodel/test/test_stub.py b/py/desidatamodel/test/test_stub.py index b6188d7d..9ce7be0a 100644 --- a/py/desidatamodel/test/test_stub.py +++ b/py/desidatamodel/test/test_stub.py @@ -685,6 +685,10 @@ def test_Stub_with_descriptions(self, mock_log): # incorrect format column description file baddescfile = self.test_files / 'bad_column_descriptions.csv' - with self.assertRaises(ValueError): + header = 'Name,dtype,Units,Description' + correct_header = 'Name,Type,Units,FullDescription,Description' + with self.assertRaises(ValueError) as exc: stub = Stub(filename, description_file=baddescfile) lines = str(stub) + self.assertEqual(exc.exception.args[0], + f'{str(baddescfile)} header {header} should be {correct_header}.')