Пример #1
0
 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), [])
Пример #2
0
 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))
Пример #3
0
 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"))
Пример #4
0
 def test_parse_comment_line_without_equals(self):
     data = "# sent_id: 1"
     self.assertEqual(parse_comment_line(data), (None, None))
Пример #5
0
 def test_parse_comment_line_without_square(self):
     data = "sent_id = 1"
     with self.assertRaises(ParseException):
         parse_comment_line(data)
Пример #6
0
 def test_parse_comment_line(self):
     data = "# sent_id = 1"
     self.assertEqual(parse_comment_line(data), ("sent_id", "1"))
Пример #7
0
 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"))
Пример #8
0
 def test_parse_comment_line_without_space(self):
     data = "#sent_id = 1"
     self.assertEqual(parse_comment_line(data), [("sent_id", "1")])