def test_rna_fasta_format_id_starts_with_space(self): filepath = self.get_data_path( 'dna-sequences-id-starts-with-space.fasta') format = RNAFASTAFormat(filepath, mode='r') with self.assertRaisesRegex(ValidationError, '1 starts with a space'): format.validate()
def test_rna_fasta_format_consecutive_IDs(self): filepath = self.get_data_path('dna-sequences-consecutive-ids.fasta') format = RNAFASTAFormat(filepath, mode='r') with self.assertRaisesRegex( ValidationError, 'consecutive descriptions.*1'): format.validate()
def test_rna_fasta_format_invalid_characters(self): filepath = self.get_data_path('not-rna-sequences.fasta') format = RNAFASTAFormat(filepath, mode='r') with self.assertRaisesRegex(ValidationError, "Invalid character '1' " ".*0 on line 2"): format.validate()
def test_rna_fasta_format_empty_file(self): filepath = os.path.join(self.temp_dir.name, 'empty') with open(filepath, 'w') as fh: fh.write('\n') format = RNAFASTAFormat(filepath, mode='r') format.validate()
def test_rna_fasta_format_no_id(self): filepath = self.get_data_path('dna-sequences-no-id.fasta') format = RNAFASTAFormat(filepath, mode='r') with self.assertRaisesRegex(ValidationError, '1.*missing an ID'): format.validate()
def test_rna_fasta_format_duplicate_ids(self): filepath = self.get_data_path('rna-sequences-with-duplicate-ids.fasta') format = RNAFASTAFormat(filepath, mode='r') with self.assertRaisesRegex(ValidationError, '6.*duplicate.*1'): format.validate()
def test_rna_fasta_format_bom_fails(self): filepath = self.get_data_path('dna-with-bom-fails.fasta') format = RNAFASTAFormat(filepath, mode='r') with self.assertRaisesRegex(ValidationError, 'First line'): format.validate()
def test_rna_fasta_format_corrupt_characters(self): filepath = self.get_data_path('dna-sequences-corrupt-characters.fasta') format = RNAFASTAFormat(filepath, mode='r') with self.assertRaisesRegex(ValidationError, 'utf-8.*2'): format.validate()
def test_rna_fasta_format_missing_initial_ID(self): filepath = self.get_data_path('dna-sequences-first-line-not-id.fasta') format = RNAFASTAFormat(filepath, mode='r') with self.assertRaisesRegex(ValidationError, 'First line'): format.validate()
def test_rna_fasta_format_validate_negative(self): filepath = self.get_data_path('not-rna-sequences') format = RNAFASTAFormat(filepath, mode='r') with self.assertRaisesRegex(ValidationError, 'RNAFASTA'): format.validate()
def test_rna_fasta_format_bom_passes(self): filepath = self.get_data_path('rna-with-bom-passes.fasta') format = RNAFASTAFormat(filepath, mode='r') format.validate()
def test_rna_fasta_format_validate_positive(self): filepath = self.get_data_path('rna-sequences.fasta') format = RNAFASTAFormat(filepath, mode='r') format.validate()