def test_should_decode_simple_VCF_string(self): self.assertEqual('foo', decode_VCF_string('"foo"'))
def test_should_fail_to_decode_string_with_unencoded_double_quote(self): with self.assertRaisesRegex(Exception, 'expected a VCF encoded string: \'"\""\''): print(decode_VCF_string('"\""'))
def test_should_decode_empty_VCF_string(self): self.assertEqual('', decode_VCF_string('""'))
def test_should_fail_to_decode_string_with_stray_backslash(self): with self.assertRaisesRegex(Exception, re.escape('expected a VCF encoded string: \'"\\\\"\'')): print(decode_VCF_string('"\\"'))
def test_should_fail_to_decode_unquoted_string(self): with self.assertRaisesRegex(Exception, 'expected a VCF encoded string: \'foo\''): print(decode_VCF_string('foo'))
def test_should_decode_complex_VCF_string(self): self.assertEqual( 'abc\\def"ghi', decode_VCF_string('"abc\\\\def\\\"ghi"'))
def test_should_decode_VCF_string_with_single_backslash(self): self.assertEqual('\\', decode_VCF_string('"\\\\"'))
def test_should_decode_VCF_string_with_single_double_quote(self): self.assertEqual('"', decode_VCF_string('"\\""'))