Exemple #1
0
 def test_valid_survey_conversion_trigger(self):
     self.assertIs(
         beamline.Beamline('test_beamline',
                           prefix=PREFIX).converted_from_survey, False)
     self.assertIs(
         beamline.Beamline('test_beamline_survey',
                           prefix=PREFIX).converted_from_survey, True)
Exemple #2
0
 def test_invalid_instanciation_empty(self):
     with self.assertRaisesRegex(beamline.BeamlineException,
                                 'Single argument expected.'):
         beamline.Beamline()
Exemple #3
0
 def test_length(self):
     self.assertEqual(
         beamline.Beamline('test_beamline', prefix=PREFIX).length, 0.215)
Exemple #4
0
 def test_name(self):
     self.assertEqual(
         beamline.Beamline('test_beamline', prefix=PREFIX).name,
         'TEST_BEAMLINE')
Exemple #5
0
 def test_invalid_elements_data_file(self):
     with self.assertRaisesRegex(OSError, "File .* does not exist"):
         beamline.Beamline('test_beamline', elements="nonexisting_file")
Exemple #6
0
 def test_invalid_elements_data_empty_list(self):
     with self.assertRaisesRegex(beamline.BeamlineException,
                                 "Invalid data type for 'elements'"):
         beamline.Beamline('test_beamline', elements=[], prefix=PREFIX)
Exemple #7
0
 def test_invalid_survey_data(self):
     with self.assertRaisesRegex(
             beamline.BeamlineException,
             "Trying to infer sequence from survey data: X and Y must be provided."
     ):
         beamline.Beamline('test_beamline_invalid_survey', prefix=PREFIX)
Exemple #8
0
 def test_valid_instanciation_file(self):
     b = beamline.Beamline('test_beamline', prefix=PREFIX)
     self.assertEqual(b.length, 0.215)
Exemple #9
0
 def test_invalid_instanciation_empty_dataframe(self):
     with self.assertRaisesRegex(beamline.BeamlineException,
                                 "Empty dataframe."):
         beamline.Beamline(pd.DataFrame())
Exemple #10
0
 def test_invalid_instanciation_empty_file(self):
     with self.assertRaisesRegex(pd.io.common.EmptyDataError,
                                 'No columns to parse from file'):
         beamline.Beamline('empty', prefix=PREFIX)
Exemple #11
0
 def test_invalid_instanciation_multiple_dataframes_arguments(self):
     with self.assertRaises(beamline.BeamlineException):
         beamline.Beamline(pd.DataFrame(), pd.DataFrame())
Exemple #12
0
 def test_invalid_instanciation_multiple_file_arguments(self):
     with self.assertRaisesRegex(beamline.BeamlineException,
                                 "Single argument expected."):
         beamline.Beamline("FILE1", "FILE2")
Exemple #13
0
 def test_invalid_instanciation_no_beamline(self):
     with self.assertRaisesRegex(OSError, 'File .* does not exist'):
         beamline.Beamline('SOME_BEAMLINE_NOT_IN_PATH')