Exemplo n.º 1
0
 def test_short_description_can_have_colons(self):
     """Make sure special characters are fine."""
     content = ":param Something: Should be okay, I guess."
     node = parse_short_description(Peaker(lex(content)))
     self.assertEqual(
         node.node_type,
         NodeType.SHORT_DESCRIPTION,
     )
Exemplo n.º 2
0
 def test_parse_short_description_is_line(self):
     """Make sure a short description is just a single line."""
     content = 'Description!\n'
     node = parse_short_description(Peaker(lex(content)))
     node_types = [x.node_type for x in node.walk()]
     self.assertEqual(
         node_types, [
             NodeType.WORD,
             NodeType.LINE,
             NodeType.SHORT_DESCRIPTION,
         ], 'Unexpectedly got {}'.format([str(x) for x in node_types]))
Exemplo n.º 3
0
 def test_parse_short_description_multiple_words(self):
     """Make sure we can have a normal short description."""
     content = 'Flips the pancake.\n'
     node = parse_short_description(Peaker(lex(content)))
     self.assertEqual(
         node.node_type,
         NodeType.SHORT_DESCRIPTION,
     )
     self.assertEqual(
         len(node.children[0].children),
         3,
     )
Exemplo n.º 4
0
 def test_parse_short_description_one_word(self):
     """Make sure a single word can suffice."""
     content = 'Kills.\n'
     node = parse_short_description(Peaker(lex(content)))
     self.assertEqual(
         node.node_type,
         NodeType.SHORT_DESCRIPTION,
     )
     self.assertEqual(
         node.children[0].children[0].value,
         'Kills.',
     )
Exemplo n.º 5
0
 def test_no_short_description_raises_exception(self):
     """Make sure no short description is unacceptable."""
     content = '\n'
     with self.assertRaises(ParserException):
         parse_short_description(Peaker(lex(content)))