def test_default_encoding_int(self): encoder = PrgEncoder() uppercase = encoder._dna_to_int("A") expected = 1 self.assertEqual(uppercase, expected) lowercase = encoder._dna_to_int("a") self.assertEqual(lowercase, expected)
def test_empty_string_raises_assert_error(self): encoder = PrgEncoder() char = "" with self.assertRaises(ConversionError) as context: encoder._dna_to_int(char) self.assertTrue("Char '' is not in" in str(context.exception))
def test_dnaToInt_custom_encoding(self): encoder = PrgEncoder(encoding={"A": 7}) char = "a" actual = encoder._dna_to_int(char) expected = 7 self.assertEqual(actual, expected)
def test_dnaToInt_char_not_valid_raises_assert_error(self, char): encoder = PrgEncoder() with self.assertRaises(ConversionError): encoder._dna_to_int(char)