def test_parse_comment_line_optional_value_no_space(self): data = '#newdoc' self.assertEqual(parse_comment_line(data), [("newdoc", None)]) data = '#newpar' self.assertEqual(parse_comment_line(data), [("newpar", None)]) data = '#invalid' self.assertEqual(parse_comment_line(data), [])
def test_parse_comment_line_optional_value(self): data = '# newdoc' self.assertEqual(parse_comment_line(data), ("newdoc", None)) data = '# newpar' self.assertEqual(parse_comment_line(data), ("newpar", None)) data = '# invalid' self.assertEqual(parse_comment_line(data), (None, None))
def test_parse_spaces_before_square(self): data = ["# a = 1", " # a = 1", "\t# a = 1"] for item in data: self.assertEqual(parse_comment_line(item), ("a", "1"))
def test_parse_comment_line_without_equals(self): data = "# sent_id: 1" self.assertEqual(parse_comment_line(data), (None, None))
def test_parse_comment_line_without_square(self): data = "sent_id = 1" with self.assertRaises(ParseException): parse_comment_line(data)
def test_parse_comment_line(self): data = "# sent_id = 1" self.assertEqual(parse_comment_line(data), ("sent_id", "1"))
def test_parse_comment_line_multiple_equals(self): data = "# text = five plus three = eight" self.assertEqual(parse_comment_line(data), ("text", "five plus three = eight"))
def test_parse_comment_line_without_space(self): data = "#sent_id = 1" self.assertEqual(parse_comment_line(data), [("sent_id", "1")])