def test_sublist(self): lines = ['- foo\n', ' - bar\n'] f = FileWrapper(lines) token1, token2 = block_token.ListItem( *block_token.ListItem.read(f)).children self.assertIsInstance(token1, block_token.Paragraph) self.assertIsInstance(token2, block_token.List)
def test_tight_list(self): lines = ['- foo\n'] f = FileWrapper(lines) list_item = block_token.ListItem(*block_token.ListItem.read(f)) self.assertEqual(list_item.loose, False) token, = list_item.children self.assertIsInstance(token, span_token.RawText) self.assertEqual(token.content, 'foo')
def test_empty_item(self): token = block_token.ListItem(['- \n']) self.assertEqual(list(token.children), [])
def test_whitespace(self): token = block_token.ListItem(['- text \n']) self._test_token(token, 'text')
def test_lazy_continuation(self): token = block_token.ListItem(['- list\n', 'content\n']) self._test_token(token, 'list content')
def test_children(self): token = block_token.ListItem(['- some text\n']) self._test_token(token, 'some text')
def test_item_with_paragraph(self): token = block_token.ListItem(['- foobar\n', 'baz\n', '\n']) child = token.children[0] self.assertIsInstance(child, block_token.Paragraph) child.children self.mock.assert_called_with('foobar\nbaz\n')