# Path: qcrash/formatters/markdown.py
# class MardownFormatter(BaseFormatter):
#     """
#     Formats the issue report using Markdown.
#     """
#     def format_body(self, description, sys_info=None, traceback=None):
#         """
#         Formats the body using markdown.
# 
#         :param description: Description of the issue, written by the user.
#         :param sys_info: Optional system information string
#         :param log: Optional application log
#         :param traceback: Optional traceback.
#         """
#         body = BODY_ITEM_TEMPLATE % {
#             'name': 'Description', 'value': description
#         }
#         if traceback:
#             traceback = '\n'.join(traceback.splitlines()[-NB_LINES_MAX:])
#             body += BODY_ITEM_TEMPLATE % {
#                 'name': 'Traceback', 'value': '```\n%s\n```' % traceback
#             }
#         if sys_info:
#             sys_info = '- %s' % '\n- '.join(sys_info.splitlines())
#             body += BODY_ITEM_TEMPLATE % {
#                 'name': 'System information', 'value': sys_info
#             }
#         return body


from qcrash.formatters.markdown import MardownFormatter


def test_format_body():
    description = 'A description'
    traceback = 'A traceback'
    sys_info = '''OS: Linux
Python: 3.4.1
Qt: 5.5.1'''
    expected = '''### Description

%s

### Traceback

```
%s
```

### System information

- OS: Linux
- Python: 3.4.1
- Qt: 5.5.1

''' % (description, traceback)


# Path: qcrash/formatters/markdown.py
# class MardownFormatter(BaseFormatter):
#     """
#     Formats the issue report using Markdown.
#     """
#     def format_body(self, description, sys_info=None, traceback=None):
#         """
#         Formats the body using markdown.
# 
#         :param description: Description of the issue, written by the user.
#         :param sys_info: Optional system information string
#         :param log: Optional application log
#         :param traceback: Optional traceback.
#         """
#         body = BODY_ITEM_TEMPLATE % {
#             'name': 'Description', 'value': description
#         }
#         if traceback:
#             traceback = '\n'.join(traceback.splitlines()[-NB_LINES_MAX:])
#             body += BODY_ITEM_TEMPLATE % {
#                 'name': 'Traceback', 'value': '```\n%s\n```' % traceback
#             }
#         if sys_info:
#             sys_info = '- %s' % '\n- '.join(sys_info.splitlines())
#             body += BODY_ITEM_TEMPLATE % {
#                 'name': 'System information', 'value': sys_info
#             }
#         return body


# Path: tests/test_formatters/test_markdown.py
from qcrash.formatters.markdown import MardownFormatter



def test_format_body():
    description = 'A description'
    traceback = 'A traceback'
    sys_info = '''OS: Linux
Python: 3.4.1
Qt: 5.5.1'''
    expected = '''### Description

%s

### Traceback

```
%s
```

### System information

- OS: Linux
- Python: 3.4.1
- Qt: 5.5.1

''' % (description, traceback)


    assert MardownFormatter().format_body(