Пример #1
0
def test_length(self):
    self.assertEqual(beamline.Beamline('test_beamline', prefix=PREFIX).length, 0.215)
Пример #2
0
def test_invalid_instanciation_empty(self):
    with self.assertRaisesRegex(beamline.BeamlineException, 'Single argument expected.'):
        beamline.Beamline()
Пример #3
0
def test_invalid_elements_data_file(self):
    with self.assertRaisesRegex(OSError, "File .* does not exist"):
        beamline.Beamline('test_beamline', elements="nonexisting_file")
Пример #4
0
def test_name(self):
    self.assertEqual(beamline.Beamline('test_beamline', prefix=PREFIX).name, 'TEST_BEAMLINE')
Пример #5
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)
Пример #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)
Пример #7
0
def test_valid_instanciation_file(self):
    b = beamline.Beamline('test_beamline', prefix=PREFIX)
    self.assertEqual(b.length, 0.215)
Пример #8
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)
Пример #9
0
def test_invalid_instanciation_empty_dataframe(self):
    with self.assertRaisesRegex(beamline.BeamlineException, "Empty dataframe."):
        beamline.Beamline(pd.DataFrame())
Пример #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)
Пример #11
0
def test_invalid_instanciation_multiple_dataframes_arguments(self):
    with self.assertRaises(beamline.BeamlineException):
        beamline.Beamline(pd.DataFrame(), pd.DataFrame())
Пример #12
0
def test_invalid_instanciation_multiple_file_arguments(self):
    with self.assertRaisesRegex(beamline.BeamlineException, "Single argument expected."):
        beamline.Beamline("FILE1", "FILE2")
Пример #13
0
def test_invalid_instanciation_no_beamline(self):
    with self.assertRaisesRegex(OSError, 'File .* does not exist'):
        beamline.Beamline('SOME_BEAMLINE_NOT_IN_PATH')