def test_headers(self):
     self.assertEqual(
             run_markdown('#h1 header'),'<h1>h1 header</h1>')
     self.assertEqual(
             run_markdown('##h2 header'),'<h2>h2 header</h2>')
     self.assertEqual(
             run_markdown('###h3 header'),'<h3>h3 header</h3>')
 def test_blockquote(self):
     self.assertEqual(
             run_markdown('>single line'),'<blockquote><p>single line</p></blockquote>')
     self.assertEqual(
             run_markdown('>blockquote\nNo blockquote\n>#header blockquote'),'<blockquote><p>blockquote</p></blockquote>\r\n<p>No blockquote</p>\r\n<blockquote><h1>header blockquote</h1></blockquote>')
     self.assertEqual(
             run_markdown('>multiline\n>blockquote'),'<blockquote><p>multiline</p>\r\n<p>blockquote</p></blockquote>')
     self.assertEqual(
             run_markdown('>multiline\n>blockquote\nWith a no blockquote line at the end'),'<blockquote><p>multiline</p>\r\n<p>blockquote</p></blockquote>\r\n<p>With a no blockquote line at the end</p>')        
    def testHeader(self):
        '''
        Lines starting with up to 3 # signs should be wrapped in header tages
        '''
        self.assertEqual(
		run_markdown('#this should be wrapped in h1 tags'),
		'<h1>this should be wrapped in h1 tags</h1>')

        self.assertEqual(
		run_markdown('##this should be wrapped in h2 tags'),
		'<h2>this should be wrapped in h2 tags</h2>')

        self.assertEqual(
	        run_markdown('###this should be wrapped in h3 tags'),
		'<h3>this should be wrapped in h3 tags</h3>')
    def test_heading(self):
	
	#Lines with '###', '##', or '#' should be wrapped with heading tags
	
	self.assertEqual(
                run_markdown('###this should be wrapped in h3 tags'),
                '<p><h3>this should be wrapped in h3 tags</h3></p>')

	self.assertEqual(
                run_markdown('##this should be wrapped in h2 tags'),
                '<p><h2>this should be wrapped in h2 tags</h2></p>')

	self.assertEqual(
                run_markdown('#this should be wrapped in h1 tags'),
                '<p><h1>this should be wrapped in h1 tags</h1></p>')
 def test_h3(self):
     '''
     Lines beginning with ### should be wrapped in 'h3' tags
     '''
     self.assertEqual(
         run_markdown('###This line should be wrapped in h3 tags'),
         '<p><h3>This line should be wrapped in h3 tags</h3></p>')
 def test_h1(self):
     '''
     Lines beginning with # should be wrapped in 'h1' tags
     '''
     self.assertEqual(
         run_markdown('#This line should be wrapped in h1 tags'),
         '<p><h1>This line should be wrapped in h1 tags</h1></p>')
    def test_blockQuote(self):
	
	#Lines with '>' should be wrapped with blockquote tags
	
	self.assertEqual(
                run_markdown('>this should be wrapped in blockquote tags\n>and this too\nbut not this'),
        	'<blockquote><p>this should be wrapped in blockquote tags</p> <p>and this too</p> </blockquote><p>but not this</p>')
Example #8
0
 def test_em(self):
     '''
     Lines surrounded by asterisks should be wrapped in 'em' tags
     '''
     print
     self.assertEqual(run_markdown('*this should be wrapped in em tags*'),
                      '<p><em>this should be wrapped in em tags</em></p>')
 def test_blockquote(self):
     '''
     Lines starting with > should be wrapped in 'blockquote' tags
     '''
     self.assertEqual(
             run_markdown('>*this* should\n> be **wrapped** in\nblockquote tags'),
             '<blockquote><p><em>this</em> should</p> <p> be <strong>wrapped</strong> in</p> </blockquote><p>blockquote tags</p>')
 def test_non_marked_lines(self):
     '''
     Non-marked lines should only get 'p' tags around all input
     '''
     self.assertEqual( 
             run_markdown('this line has no special handling'), 
             '<p>this line has no special handling</p>')
 def test_h1(self):
     '''
     Lines beginning with # should be wrapped in 'h1' tags
     '''
     self.assertEqual(
         run_markdown('#This line should be wrapped in h1 tags'),
         '<p><h1>This line should be wrapped in h1 tags</h1></p>')
Example #12
0
 def test_code(self):
     '''
     Text surrounded by tick marks (`) should be wrapped in 'code' tags
     '''
     self.assertEqual(
         run_markdown("`this should be wrapped in 'code' tags`"),
         "<p><code>this should be wrapped in 'code' tags</code></p>")
Example #13
0
 def test_em(self):
     '''
     Text surrounded by asterisks should be wrapped in 'em' tags
     '''
     self.assertEqual(
         run_markdown("*this should be wrapped in 'em' tags*"),
         "<p><em>this should be wrapped in 'em' tags</em></p>")
Example #14
0
 def test_strong(self):
     '''
     Text surrounded by double asterisks should be wrapped in 'strong' tags
     '''
     self.assertEqual(
         run_markdown("**this should be wrapped in 'strong' tags**"),
         "<p><strong>this should be wrapped in 'strong' tags</strong></p>")
 def test_block(self):
     self.assertEqual(
         run_markdown(
             '>hello there\n>my name is\n>Lucas Standaert\nno more blockquote'
         ),
         '<blockquote><p>hello there</p><p>my name is</p><p>Lucas Standaert</p></blockquote><p>no more blockquote</p>'
     )
 def test_header1(self):
     """
     Lines started with # should be wrapped in h1 tags
     """
     self.assertEqual(
         run_markdown("#this should be wrapped in h1 tags"), "<p><h1>this should be wrapped in h1 tags</h1></p>"
     )
 def test_blockquote(self):
     '''
     Lines surrounded by double asterisks should be wrapped in 'strong' tags
     '''
     self.assertEqual(
             run_markdown('>This should be h3'),
             '<p><blockquote>This should be h3</blockquote></p>')
 def test_h3(self):
     '''
     Lines starting with ### should be wrapped in 'h3' tags
     '''
     self.assertEqual(
             run_markdown('###this should be wrapped in h3 tags'),
             '<p><h3>this should be wrapped in h3 tags</h3></p>')
 def test_em(self):
     '''
     Lines surrounded by asterisks should be wrapped in 'em' tags
     '''
     self.assertEqual( 
             run_markdown('*this should be wrapped in em tags*'),
             '<p><em>this should be wrapped in em tags</em></p>')
 def test_h1(self):
     '''
     #114514 is not h1
     # 114514 is h1
     '''
     self.assertEqual(run_markdown('# this should be wrapped in h1 tags'),
                      '<p><h1>this should be wrapped in h1 tags</h1></p>')
 def test_em(self):
     """
     Lines surrounded by asterisks should be wrapped in 'em' tags
     """
     self.assertEqual(
         run_markdown("*this should be wrapped in em tags*"), "<p><em>this should be wrapped in em tags</em></p>"
     )
 def test_H3(self):
     '''
     Lines surrounded by double asterisks should be wrapped in 'H3' tags
     '''
     self.assertEqual( 
             run_markdown('###this should be wrapped in H3 tags'),
             '<p><h3>this should be wrapped in H3 tags</h3></p>')
 def test_Block(self):
     '''
     Lines preceded by the more than symbol(>) should be wrapped in 'blockquote' tags
     '''
     self.assertEqual( 
             run_markdown('>this should be wrapped in blockquote tags'),
             '<p><blockquote>this should be wrapped in blockquote tags\n</blockquote></p>')
 def test_H3(self):
     '''
     Lines preceded by three pound symbols(###) should be wrapped in 'h3' tags
     '''
     self.assertEqual( 
             run_markdown('###this should be wrapped in h3 tags'),
             '<p><h3>this should be wrapped in h3 tags</h3></p>')
 def test_H2(self):
     '''
     Lines preceded by two pound symbols(##) should be wrapped in 'h2' tags
     '''
     self.assertEqual( 
             run_markdown('##this should be wrapped in h2 tags'),
             '<p><h2>this should be wrapped in h2 tags</h2></p>')
 def test_H1(self):
     '''
     Lines preceded by one pound symbol(#) should be wrapped in 'h1' tags
     '''
     self.assertEqual( 
             run_markdown('#this should be wrapped in h1 tags'),
             '<p><h1>this should be wrapped in h1 tags</h1></p>')
Example #27
0
 def test_blockquote(self):
         '''
         Lines starting with >
         '''
         self.assertEqual(
         run_markdown('> this should be wrapped in blockquote tags\r\n>hi'),
         '<blockquote>\r\n<p> this should be wrapped in blockquote tags</p> <p>hi</p> </blockquote>')
 def test_BlockQuotes(self):
     '''
     Lines surrounded by double asterisks should be wrapped in 'H1' tags
     '''
     self.assertEqual( 
             run_markdown('>this should be wrapped in blockquotes\nthis should not be'),
             '<p><blockquote>this should be wrapped in blockquotes</p>\n<p>this should not be</p>')
Example #29
0
 def test_H1(self):
     
     #Lines surrounded by pound symbol should be wrapped in 'h1' tags
     
     self.assertEqual( 
             run_markdown('#this should be wrapped in h1 tags#'),
             '<p><h1>this should be wrapped in h1 tags</h1></p>')
 def test_h3(self):
     '''
     Lines surrounded by double asterisks should be wrapped in 'strong' tags
     '''
     self.assertEqual(
             run_markdown('###This should be h3'),
             '<p><h3>This should be h3</h3></p>')
 def test_strong(self):
     '''
     Lines surrounded by double asterisks should be wrapped in 'strong' tags
     '''
     self.assertEqual( 
             run_markdown('**this should be wrapped in strong tags**'),
             '<p><strong>this should be wrapped in strong tags</strong></p>')
 def test_strong(self):
     '''
     Lines surrounded by double asterisks should be wrapped in 'strong' tags
     '''
     self.assertEqual(
         run_markdown('**this should be wrapped in strong tags**'),
         '<p><strong>this should be wrapped in strong tags</strong></p>')
 def test_header(self):
     """
     Lines starting with pound signs should be wrapped in 'h1' tags
     """
     self.assertEqual(
         run_markdown("#this should be wrapped in h1 tags"), "<p><h1>this should be wrapped in h1 tags</h1></p>"
     )
Example #34
0
 def test_h2(self):
     
     #Lines surrounded by 2 pound symbols should be wrapped in 'h2' tags
     
     self.assertEqual( 
             run_markdown('##this should be wrapped in h2 tags##'),
             '<p><h2>this should be wrapped in h2 tags</h2></p>')
 def test_h1(self):
     '''
     Lines starting with # should be wrapped in 'h1' tags
     '''
     self.assertEqual(
             run_markdown('#this should be wrapped in h1 tags\n'),
             '<p><h1>this should be wrapped in h1 tags</h1></p>')
Example #36
0
 def test_h3(self):
     
     #Lines surrounded by 3 pound symbols should be wrapped in 'h3' tags
     
     self.assertEqual( 
             run_markdown('###this should not be wrapped in 3 pound tags###'),
             '<p><h3>this should not be wrapped in 3 pound tags</h3></p>')
 def test_h3(self):
     '''
     Lines beginning with ### should be wrapped in 'h3' tags
     '''
     self.assertEqual(
         run_markdown('###This line should be wrapped in h3 tags'),
         '<p><h3>This line should be wrapped in h3 tags</h3></p>')
 def test_h2(self):
     '''
     Lines starting with ## should be wrapped in 'h2' tags
     '''
     self.assertEqual(
             run_markdown('##this should be wrapped in h2 tags\n'),
             '<p><h2>this should be wrapped in h2 tags</h2></p>')
 def test_h1(self):
     '''
     Lines beggining with ### should be wrapped in 'h3' tags
     '''
     self.assertEqual( 
             run_markdown('###this should be wrapped in h3 tags**'),
             '<h3>this should be wrapped in strong tags</h3>')
 def test_header3(self):
     """
     Lines starting with two pound signs should be wrapped in 'h3' tags
     """
     self.assertEqual(
         run_markdown("###this should be wrapped in h3 tags"), "<p><h3>this should be wrapped in h3 tags</h3></p>"
     )
Example #41
0
 def test_non_marked_lines(self):
     '''
     Non-marked lines should only get 'p' tags around all input
     '''
     self.assertEqual(
             run_markdown('this line has no special handling'),
             '<p>this line has no special handling</p>')
 def test_H1(self):
     '''
     Lines surrounded by double asterisks should be wrapped in 'H1' tags
     '''
     self.assertEqual( 
             run_markdown('#this should be wrapped in H1 tags'),
             '<p><h1>this should be wrapped in H1 tags</h1></p>')
    def test_blockquote(self):
        self.assertEqual(
            run_markdown('''Hello there
> This is a blockquote
> It has many letters
This is not a block quote'''),
            '''<p>Hello there</p> <blockquote><p>This is a blockquote</p> <p>It has many letters</p> </blockquote><p>This is not a block quote</p>'''
        )
Example #44
0
 def thest_blockquote(self):
     '''
     Lines begins by > should be wrapped in 'blockquote' tags
     '''
     self.assertEqual(
         run_markdown('>this should be wrapped in blockquote tags'),
         '<p><blockquote>this should be wrapped in blockquote tags</blockquote></p>'
     )
Example #45
0
 def test_Block(self):
     '''
     Lines preceded by the more than symbol(>) should be wrapped in 'blockquote' tags
     '''
     self.assertEqual(
         run_markdown('>this should be wrapped in blockquote tags'),
         '<p><blockquote>this should be wrapped in blockquote tags\n</blockquote></p>'
     )
Example #46
0
 def test_h1(self):
     '''
     Lines started by single hashtags should be wrapped in 'h1' tags
     ''' 
     self.assertEqual(
             run_markdown('# this should be wrapped in h1 tags'), 
             '<p><h1>this should be wrapped in h1 tags</h1></p>'
     )
Example #47
0
 def test_h3(self):
     '''
     Lines started by triple hashtags should be wrapped in 'h3' tags
     ''' 
     self.assertEqual(
             run_markdown('### this should be wrapped in h3 tags'), 
             '<p><h3>this should be wrapped in h3 tags</h3></p>'
     )
 def test_blockquote_1(self):
     '''
     basic blockquote test
     '''
     self.assertEqual(
         run_markdown('> 1\n> 2\n> 3\n4'),
         '<blockquote>\r\n<p>1</p> <p>2</p> <p>3</p> </blockquote>\r\n<p>4</p>'
     )
Example #49
0
 def test_hhh(self):
         '''
          Lines should replace # with 'h1' tags
         '''
         self.assertEqual(
             run_markdown('###this should be in h1 tags'),
             '<p><h3>this should be in h1 tags</h3></p>'
         ) 
Example #50
0
 def test_bq(self):
         '''
          Lines should replace # with 'h1' tags
         '''
         self.assertEqual(
             run_markdown('>this should be in h1 tags'),
             '<p><blockquote>this should be in h1 tags\n</blockquote></p>'
         )   
def test_markdown(test_data):
    (the_input, the_expected_output) = test_data
    the_output = run_markdown(the_input)
    print('\ntest_markdown():')
    print('  input   : %s' % the_input)
    print('  output  : %s' % the_output)
    print('  expected: %s' % the_expected_output)
    assert the_output == the_expected_output
Example #52
0
 def test_blockquote(self):
     '''
     Lines that start with angle-brackets (>) should be wrapped in 'blockquote' tags
     '''
     self.assertEqual(
         run_markdown("> This should be wrapped in 'blockquote' tags"),
         "<p><blockquote>This should be wrapped in 'blockquote' tags</blockquote></p>"
     )
def test_strong():
    """
        Lines surrounded by double asterisks should be wrapped in 'strong' tags
    """
    assert_equals(
        run_markdown('**this should be wrapped in strong tags**'),
        '<p><strong>this should be wrapped in strong \
                  tags</strong></p>')
Example #54
0
 def test_block(self):
     '''
     Lines starting with > should be block quotes
     '''
     self.assertEqual(
         run_markdown('> this is a blockquote\n this is not'),
         '<blockquote>this is a blockquote\n\n</blockquote>\n this is not'
     )
 def test_blockquote_2(self):
     '''
     testing block quote with a header inside
     '''
     self.assertEqual(
         run_markdown('> # header\n> paragraph\nquote over'),
         '<blockquote>\r\n<h1>header</h1>\r\n<p>paragraph</p> </blockquote>\r\n<p>quote over</p>'
     )
Example #56
0
 def test_h2(self):
     '''
     Lines started by double hashtags should be wrapped in 'h2' tags
     ''' 
     self.assertEqual(
             run_markdown('## this should be wrapped in h2 tags'), 
             '<p><h2>this should be wrapped in h2 tags</h2></p>'
     )
 def test_block(self):
     '''
     The first line starting with > should be replaced with <blockquote> until another line is processed without a > , at which time 
     </blockquote> is added to the end
     '''
     self.assertEqual(
         run_markdown('> this should be wrapped in block quotes\n\n'),
         '<p><blockquote>this should be wrapped in block quotes </blockquote></p>'
     )
Example #58
0
 def test_blockquote(self):
     '''
     Lines starting with > should be wrapped in 'blockquote' tags
     '''
     self.assertEqual(
         run_markdown(
             '>*this* should\n> be **wrapped** in\nblockquote tags'),
         '<blockquote><p><em>this</em> should</p> <p> be <strong>wrapped</strong> in</p> </blockquote><p>blockquote tags</p>'
     )
Example #59
0
 def test_h(self):
     '''
     Lines that start with 1 to 6 hash marks (#) = the HTML header level
     '''
     for n in range(1, 7):
         self.assertEqual(
             run_markdown(
                 '%s this should be wrapped in header level %d tags' %
                 ('#' * n, n)),
             '<p><h%d>this should be wrapped in header level %d tags</h%d></p>'
             % (n, n, n))
 def test_blockquote(self):
     '''
     Testing:
     
     > #This
     > Line
     > Is a
     > Blockquote
     
     should equal to:
     
     <blockquote>
     <p><h1>This</h1></p>
     <p>Line</p>
     <p>Is a</p>
     <p>Blockquote</p>
     </blockquote>
     
     '''
     self.assertEqual(
         run_markdown('> #This\n> Line\n> Is a\n> Blockquote'),
         '<blockquote> <p><h1>This</h1></p> <p>Line</p> <p>Is a</p> <p>Blockquote</p> </blockquote>')