Changeset a81af92 in sasview


Ignore:
Timestamp:
Apr 9, 2017 5:13:18 AM (8 years ago)
Author:
Adam Washington <adam.washington@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
e801a4e
Parents:
f344f6c
Message:

Reject time travelling SESANS files

Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/dataloader/readers/sesans_reader.py

    rf344f6c ra81af92  
    6969            if "FileFormatVersion" not in self.params: 
    7070                raise RuntimeError("SES file missing FileFormatVersion") 
     71            if float(self.params["FileFormatVersion"]) >= 2.0: 
     72                raise RuntimeError("SASView only supports SES version 1") 
    7173 
    7274            if "SpinEchoLength_unit" not in self.params: 
  • test/sasdataloader/test/utest_sesans.py

    rf344f6c ra81af92  
    7070            "sesans_examples/no_version.ses") 
    7171 
     72    def test_sesans_future_version(self): 
     73        """ 
     74            Confirm that sesans files that, according to semantic version, are from a future, backwards-incompatible version of the SES file format throw an exception. 
     75        """ 
     76        self.assertRaises( 
     77            RuntimeError, 
     78            self.loader, 
     79            "sesans_examples/next_gen.ses") 
    7280if __name__ == "__main__": 
    7381    unittest.main() 
Note: See TracChangeset for help on using the changeset viewer.