def test_error_no_description_meta(self): with self.assertRaises(TidysolException) as context: ComsolExportFile( 'tests\\commands\\data\\bad-no-descriptionsmeta.txt') assert ('Could not find a \"% Description:\" line' == str( context.exception))
def test_error_wrong_num_descriptions(self): with self.assertRaises(TidysolException) as context: ComsolExportFile( 'tests\\commands\\data\\bad-wrong-num-descriptions.txt') assert ('Expected 19 descriptions of variables but read 21' == str( context.exception))
def test_multiple_uncescaped_commas_descriptions(self): cef = ComsolExportFile( 'tests\\commands\\data\\good-mulitple-unesecaped-commas.txt') assert (28 == len(cef.columnVars))
def test_error_wrong_num_nodes(self): with self.assertRaises(TidysolException) as context: ComsolExportFile('tests\\commands\\data\\bad-wrong-num-nodes.txt') assert ('Expected 5 nodes but read 6' == str(context.exception))
def test_error_wrong_number_of_vars(self): with self.assertRaises(TidysolException) as context: ComsolExportFile('tests\\commands\\data\\bad-wrong-num-vars.txt') assert ( 'Expected 21 variables (3 dimensions and 18 expressions) but found 22 (3 dimensions and 19 expressions)' == str(context.exception))
def test_error_no_vars_lines(self): with self.assertRaises(TidysolException) as context: ComsolExportFile('tests\\commands\\data\\bad-no-varsline.txt') assert ('Could not find a line defining variables' == str( context.exception))
def test_error_multiple_vars_lines(self): with self.assertRaises(TidysolException) as context: ComsolExportFile('tests\\commands\\data\\bad-two-varsline.txt') assert ('Found more than one line naming variables: 9 & 10' == str( context.exception))
def test_error_file_does_not_exist(self): with self.assertRaises(TidysolException) as context: ComsolExportFile('tests\\commands\\data\\dne.txt') assert ('Could not find file: tests\\commands\\data\\dne.txt' == str( context.exception))