def test_2g_with_bad_file(self): options = {} options['ID'] = os.path.join(WD, 'data_files', 'Measurement_Import', '2G_bin_magic', 'mn1') options['mag_file'] = 'mn001-1ax.dat' program_ran, error_message = _2g_bin_magic.convert(**options) self.assertFalse(program_ran) self.assertEqual(error_message, "bad mag file")
def test_2g_fail_option6(self): options = {} options['ID'] = os.path.join(WD, 'data_files', 'Measurement_Import', '2G_bin_magic', 'mn1') options['mag_file'] = 'mn001-1a.dat' options['samp_con'] = '6' program_ran, error_message = _2g_bin_magic.convert(**options) self.assertFalse(program_ran) self.assertEqual(error_message, 'Naming convention option [6] not currently supported')
def test_2g_succeed_option7(self): options = {} options['ID'] = os.path.join(WD, 'data_files', 'Measurement_Import', '2G_bin_magic', 'mn1') options['mag_file'] = 'mn001-1a.dat' options['samp_con'] = '7-3' program_ran, outfile = _2g_bin_magic.convert(**options) self.assertTrue(program_ran) self.assertEqual(os.path.split(outfile)[1], 'measurements.txt')
def test_2g_fail_option7(self): options = {} options['ID'] = os.path.join(WD, 'data_files', 'Measurement_Import', '2G_bin_magic', 'mn1') options['mag_file'] = 'mn001-1a.dat' options['samp_con'] = '7' program_ran, error_message = _2g_bin_magic.convert(**options) self.assertFalse(program_ran) self.assertEqual(error_message, 'option [7] must be in form 7-Z where Z is an integer')
def test_2g_with_files(self): options = {} options['ID'] = os.path.join(WD, 'data_files', 'Measurement_Import', '2G_bin_magic', 'mn1') options['mag_file'] = 'mn001-1a.dat' program_ran, outfile = _2g_bin_magic.convert(**options) self.assertTrue(program_ran) self.assertEqual(os.path.split(outfile)[1], 'measurements.txt') self.assertTrue(os.path.isfile(outfile)) meas_df = nb.MagicDataFrame(outfile) self.assertIn('sequence', meas_df.df.columns)
def test_2g_fail_option6(self): options = {} options['ID'] = os.path.join(WD, 'data_files', 'Measurement_Import', '2G_bin_magic', 'mn1') options['mag_file'] = 'mn001-1a.dat' options['samp_con'] = '6' program_ran, error_message = _2g_bin_magic.convert(**options) self.assertFalse(program_ran) self.assertEqual( error_message, 'Naming convention option [6] not currently supported')
def test_2g_fail_option7(self): options = {} options['ID'] = os.path.join(WD, 'data_files', 'Measurement_Import', '2G_bin_magic', 'mn1') options['mag_file'] = 'mn001-1a.dat' options['samp_con'] = '7' program_ran, error_message = _2g_bin_magic.convert(**options) self.assertFalse(program_ran) self.assertEqual( error_message, 'option [7] must be in form 7-Z where Z is an integer')
def test_2g_with_path(self): options = {} input_dir = os.path.join(WD, 'data_files', 'Measurement_Import', '2G_bin_magic', 'mn1') #options['ID'] = os.path.join(WD, 'data_files', 'Measurement_Import', # '2G_bin_magic', 'mn1') options['mag_file'] = os.path.join(input_dir, 'mn001-1a.dat') options['meas_file'] = os.path.join(input_dir, 'mn001-1a.magic') options['spec_file'] = os.path.join('data_files', 'custom_specimens.txt') options['dir_path'] = 'data_files' program_ran, outfile = _2g_bin_magic.convert(**options) self.assertEqual(outfile, options['meas_file'])
def test_2g_with_options(self): options = {} options['ID'] = os.path.join(WD, 'data_files', 'Measurement_Import', '2G_bin_magic', 'mn1') options['mag_file'] = 'mn001-1a.dat' options['meas_file'] = 'mn001-1a.magic' options['samp_con'] = '4-3' options['inst'] = 'instrument' options['noave'] = 0 options['specnum'] = 2 options['location_name'] = 'location' options['or_con'] = '4' options['gmeths'] = 'FS-LOC-MAP:SO-POM' program_ran, outfile = _2g_bin_magic.convert(**options) self.assertTrue(program_ran) self.assertEqual(os.path.split(outfile)[1], 'mn001-1a.magic')
def test_2g_with_no_files(self): options = {} program_ran, error_message = _2g_bin_magic.convert(**options) self.assertFalse(program_ran) self.assertEqual(error_message, 'mag file is required input')