def test_reverse_complement_gives_correct_sequence(self): """ Test reverse complement method with test sequences """ dna_util_obj = DnaUtil(TEST_FWD_SEQ) expected = TEST_REV_COMP_SEQ actual = dna_util_obj.reverse_complement() self.assertEqual(expected, actual)
def test_reverse_complement_from_extra_dataset(self): """ Test reverse_complement method with 'Extra' dataset """ file_util_obj = FileUtil(FIXTURE2_FPATH) inputs = file_util_obj.inputs expected = file_util_obj.outputs[0] sequence_obj = DnaUtil(inputs[0]) actual = sequence_obj.reverse_complement() self.assertEqual(expected, actual)
def test_locate_pattern_from_dataset_four(self): """ Test locate_pattern method with 'Test' dataset four """ file_util_obj = FileUtil(FIXTURE8_FPATH) inputs = file_util_obj.inputs expected = [int(i) for i in file_util_obj.outputs] sequence_obj = DnaUtil(inputs[1]) actual = sequence_obj.locate_pattern_in_sequence(inputs[0]) self.assertEqual(expected, actual)
def test_raises_value_error_when_supplied_bad_sequence(self): """ Test that DnaUtil.__init__ raises ValueError when given bad sequence """ with self.assertRaises(ValueError) as c: DnaUtil(BAD_DNA) self.assertTrue( "IUPAC non-ambiguous DNA characters required" in c.exception)
def test_object_created_with_lowercase_dna_sequence(self): """ Test with a 'good lowercase' DNA sequence """ dna_util_obj = DnaUtil(LOWER_DNA) expected = GOOD_DNA actual = dna_util_obj.sequence self.assertEqual(expected, actual)
def test_object_created_with_good_dna_sequence(self): """ Test with a 'good' expected DNA sequence """ dna_util_obj = DnaUtil(GOOD_DNA) expected = GOOD_DNA actual = dna_util_obj.sequence self.assertEqual(expected, actual)