def test_bold_alt_text(markdown): text = "**formatted**" tokens = tokenize(text) parser = Parser(tokens) parser.parse() assert_tree( parser.tree, [ast.Paragraph([ast.BoldText(ast.Text("formatted"))])], markdown=markdown, )
def test_bold_italics_text(markdown): text = "Here I _am_ in the **light** of ***day***\nLet the storm rage on" tokens = tokenize(text) parser = Parser(tokens) parser.parse() assert_tree( parser.tree, [ ast.Paragraph([ ast.Text("Here I "), ast.ItalicText(ast.Text("am"), md_tag="_"), ast.Text(" in the "), ast.BoldText(ast.Text("light")), ast.Text(" of "), ast.BoldText(ast.ItalicText(ast.Text("day"))), ]), ast.Paragraph([ast.Text("Let the storm rage on")]), ], markdown=markdown, )
def test_underline_bold_text(markdown): text = "An __**underline bold**__ example" tokens = tokenize(text) parser = Parser(tokens) parser.parse() assert_tree( parser.tree, [ ast.Paragraph([ ast.Text("An "), ast.UnderlineText(ast.BoldText(ast.Text("underline bold"))), ast.Text(" example"), ]) ], markdown=markdown, )
def test_multiple_formatted_text(markdown): text = "An __*underline italics*__ example.\nI **am** depressed." tokens = tokenize(text) parser = Parser(tokens) parser.parse() assert_tree( parser.tree, [ ast.Paragraph([ ast.Text("An "), ast.UnderlineText(ast.ItalicText( ast.Text("underline italics"))), ast.Text(" example."), ]), ast.Paragraph([ ast.Text("I "), ast.BoldText(ast.Text("am")), ast.Text(" depressed.") ]), ], markdown=markdown, )