# -*- coding: utf-8 -*-
"""
Python Markdown
A Python implementation of John Gruber's Markdown.
Documentation: https://python-markdown.github.io/
GitHub: https://github.com/Python-Markdown/markdown/
PyPI: https://pypi.org/project/Markdown/
Started by Manfred Stienstra (http://www.dwerg.net/).
Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org).
Currently maintained by Waylan Limberg (https://github.com/waylan),
Dmitry Shachnev (https://github.com/mitya57) and Isaac Muse (https://github.com/facelessuser).
Copyright 2007-2018 The Python Markdown Project (v. 1.7 and later)
Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b)
Copyright 2004 Manfred Stienstra (the original version)
License: BSD (see LICENSE.md for details).
"""
from markdown.test_tools import TestCase
class TestHorizontalRules(TestCase):
def test_hr_asterisks(self):
self.assertMarkdownRenders(
'***',
'
'
)
def test_hr_asterisks_spaces(self):
self.assertMarkdownRenders(
'* * *',
'
'
)
def test_hr_asterisks_long(self):
self.assertMarkdownRenders(
'*******',
'
'
)
def test_hr_asterisks_spaces_long(self):
self.assertMarkdownRenders(
'* * * * * * *',
'
'
)
def test_hr_asterisks_1_indent(self):
self.assertMarkdownRenders(
' ***',
'
'
)
def test_hr_asterisks_spaces_1_indent(self):
self.assertMarkdownRenders(
' * * *',
'
'
)
def test_hr_asterisks_2_indent(self):
self.assertMarkdownRenders(
' ***',
'
'
)
def test_hr_asterisks_spaces_2_indent(self):
self.assertMarkdownRenders(
' * * *',
'
'
)
def test_hr_asterisks_3_indent(self):
self.assertMarkdownRenders(
' ***',
'
'
)
def test_hr_asterisks_spaces_3_indent(self):
self.assertMarkdownRenders(
' * * *',
'
'
)
def test_hr_asterisks_trailing_space(self):
self.assertMarkdownRenders(
'*** ',
'
'
)
def test_hr_asterisks_spaces_trailing_space(self):
self.assertMarkdownRenders(
'* * * ',
'
'
)
def test_hr_hyphens(self):
self.assertMarkdownRenders(
'---',
'
'
)
def test_hr_hyphens_spaces(self):
self.assertMarkdownRenders(
'- - -',
'
'
)
def test_hr_hyphens_long(self):
self.assertMarkdownRenders(
'-------',
'
'
)
def test_hr_hyphens_spaces_long(self):
self.assertMarkdownRenders(
'- - - - - - -',
'
'
)
def test_hr_hyphens_1_indent(self):
self.assertMarkdownRenders(
' ---',
'
'
)
def test_hr_hyphens_spaces_1_indent(self):
self.assertMarkdownRenders(
' - - -',
'
'
)
def test_hr_hyphens_2_indent(self):
self.assertMarkdownRenders(
' ---',
'
'
)
def test_hr_hyphens_spaces_2_indent(self):
self.assertMarkdownRenders(
' - - -',
'
'
)
def test_hr_hyphens_3_indent(self):
self.assertMarkdownRenders(
' ---',
'
'
)
def test_hr_hyphens_spaces_3_indent(self):
self.assertMarkdownRenders(
' - - -',
'
'
)
def test_hr_hyphens_trailing_space(self):
self.assertMarkdownRenders(
'--- ',
'
'
)
def test_hr_hyphens_spaces_trailing_space(self):
self.assertMarkdownRenders(
'- - - ',
'
'
)
def test_hr_underscores(self):
self.assertMarkdownRenders(
'___',
'
'
)
def test_hr_underscores_spaces(self):
self.assertMarkdownRenders(
'_ _ _',
'
'
)
def test_hr_underscores_long(self):
self.assertMarkdownRenders(
'_______',
'
'
)
def test_hr_underscores_spaces_long(self):
self.assertMarkdownRenders(
'_ _ _ _ _ _ _',
'
'
)
def test_hr_underscores_1_indent(self):
self.assertMarkdownRenders(
' ___',
'
'
)
def test_hr_underscores_spaces_1_indent(self):
self.assertMarkdownRenders(
' _ _ _',
'
'
)
def test_hr_underscores_2_indent(self):
self.assertMarkdownRenders(
' ___',
'
'
)
def test_hr_underscores_spaces_2_indent(self):
self.assertMarkdownRenders(
' _ _ _',
'
'
)
def test_hr_underscores_3_indent(self):
self.assertMarkdownRenders(
' ___',
'
'
)
def test_hr_underscores_spaces_3_indent(self):
self.assertMarkdownRenders(
' _ _ _',
'
'
)
def test_hr_underscores_trailing_space(self):
self.assertMarkdownRenders(
'___ ',
'
'
)
def test_hr_underscores_spaces_trailing_space(self):
self.assertMarkdownRenders(
'_ _ _ ',
'
'
)
def test_hr_before_paragraph(self):
self.assertMarkdownRenders(
self.dedent(
"""
***
An HR followed by a paragraph with no blank line.
"""
),
self.dedent(
"""
An HR followed by a paragraph with no blank line.
"""
)
)
def test_hr_after_paragraph(self):
self.assertMarkdownRenders(
self.dedent(
"""
A paragraph followed by an HR with no blank line.
***
"""
),
self.dedent(
"""
A paragraph followed by an HR with no blank line.
"""
)
)
def test_not_hr_2_asterisks(self):
self.assertMarkdownRenders(
'**',
'**
'
)
def test_not_hr_2_asterisks_spaces(self):
self.assertMarkdownRenders(
'* *',
self.dedent(
"""
"""
)
)
def test_not_hr_2_hyphens(self):
self.assertMarkdownRenders(
'--',
'--
'
)
def test_not_hr_2_hyphens_spaces(self):
self.assertMarkdownRenders(
'- -',
self.dedent(
"""
"""
)
)
def test_not_hr_2_underscores(self):
self.assertMarkdownRenders(
'__',
'__
'
)
def test_not_hr_2_underscores_spaces(self):
self.assertMarkdownRenders(
'_ _',
'_ _
'
)