Changeset 1171 for trunk/bindings/python/nxstest.py
- Timestamp:
- 16/01/09 23:26:16 (3 years ago)
- File:
-
- 1 edited
-
trunk/bindings/python/nxstest.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bindings/python/nxstest.py
r1170 r1171 45 45 print "%(prefix)s@%(attr)s: %(value)s" % locals() 46 46 for name,nxclass in file.entries(): 47 if nxclass.startswith("CDF"): continue # Root has an extra CDF class 47 48 if nxclass == "SDS": 48 49 shape,dtype = file.getinfo() … … 189 190 file = nxs.open(filename,'rw') 190 191 if filename != file.inquirefile(): fail("Files don't match") 191 attrs = file.getattrinfo() 192 if attrs != 4: fail("Expected 4 root attributes but got %d", attrs) 193 for i in range(attrs): 192 193 # check headers 194 num_attrs = file.getattrinfo() 195 wxattrs = ['xmlns','xmlns:xsi','xsi:schemaLocation', 'XML_version'] 196 w4attrs = ['HDF_version'] 197 w5attrs = ['HDF5_Version'] 198 extras = dict(wx=wxattrs,w4=w4attrs,w5=w5attrs) 199 expected_attrs = ['NeXus_version','file_name','file_time']+extras[mode] 200 for i in range(num_attrs): 194 201 name,dims,type = file.getnextattr() 195 if name not in ['file_time','HDF_version','HDF5_Version','XML_version', 196 'NeXus_version','file_name']: 202 if name not in expected_attrs: 197 203 fail("attribute %s unexpected"%(name)) 204 if num_attrs != len(expected_attrs): 205 fail("Expected %d root attributes but got %d" 206 % (len(expected_attrs),num_attrs)) 198 207 199 208 file.opengroup('entry','NXentry') … … 230 239 if not get == numpy.int32(42): fail("i4_attribute retrieved %s"%(get)) 231 240 get = file.getattr("r4_attribute",1,'float32') 232 if not get == numpy.float32(3.14159265): fail("r4_attribute retrieved %s"%(get)) 241 if ((mode=='wx' and not abs(get-3.14159265) < 1e-6) or 242 (mode!='wx' and not get == numpy.float32(3.14159265))): 243 fail("r4_attribute retrieved %s"%(get)) 233 244 ## Oops... NAPI doesn't support array attributes 234 245 #expect = numpy.array([3,2],dtype='int32')
Note: See TracChangeset
for help on using the changeset viewer.
