"""Test cases for Blocks (define)."""
from ... import util
class TestBlocksDefinition(util.MdCase):
"""Test Blocks admonitions cases."""
extension = ['pymdownx.blocks.definition', 'pymdownx.blocks.html']
def test_def(self):
"""Test definition."""
self.check_markdown(
R'''
/// define
Apple
- Pomaceous fruit of plants of the genus Malus in
the family Rosaceae.
///
''',
R'''
- Apple
- Pomaceous fruit of plants of the genus Malus in
the family Rosaceae.
''',
True
)
def test_multi_def(self):
"""Test multiple definitions."""
self.check_markdown(
R'''
/// define
Apple
- Pomaceous fruit of plants of the genus Malus in
the family Rosaceae.
Orange
- The fruit of an evergreen tree of the genus Citrus.
///
''',
R'''
- Apple
- Pomaceous fruit of plants of the genus Malus in
the family Rosaceae.
- Orange
- The fruit of an evergreen tree of the genus Citrus.
''',
True
)
def test_multi_term(self):
"""Test definitions with multiple terms."""
self.check_markdown(
R'''
/// define
Term 1
Term 2
- Definition a
Term 3
- Definition b
///
''',
r'''
- Term 1
- Term 2
- Definition a
- Term 3
- Definition b
''',
True
)
def test_handling_of_dt_dd(self):
"""Test that we ignore `dt` and `dd` tags."""
self.check_markdown(
R'''
/// define
//// html | dt
term
////
//// html | dd
Some description.
////
///
''',
R'''
- term
- Some description.
''',
True
)
def test_non_paragraph_block(self):
"""Test that we sanely handle a non-paragraph term."""
self.check_markdown(
R'''
/// define
> A non non-paragraph term
- description
///
''',
R'''
-
A non non-paragraph term
- description
''',
True
)