コード例 #1
0
    def test_to_cigar_unit(self, length, opstr, expected):
        # Check we can convert a tuple and list of length and opstr.
        self.assertEqual(cigar.to_cigar_unit((length, opstr)), expected)
        self.assertEqual(cigar.to_cigar_unit([length, opstr]), expected)

        # Check that we can convert a string version len+opstr.
        self.assertEqual(cigar.to_cigar_unit(str(length) + opstr), expected)

        # Check that we can pass a CigarUnit through without modification.
        self.assertEqual(cigar.to_cigar_unit(expected), expected)

        # Check that we can pass length as a string.
        self.assertEqual(cigar.to_cigar_unit((str(length), opstr)), expected)
コード例 #2
0
 def test_to_cigar_unit_detects_bad_args(self, bad):
     with self.assertRaises(ValueError):
         cigar.to_cigar_unit(bad)