Test that source Markdown text renders to expected output with given keywords. `expected_attrs` accepts a `dict`. Each key should be the name of an attribute on the `Markdown` instance and the value should be the expected value after the source text is parsed by Mar
(self, source, expected, expected_attrs=None, **kwargs)
| 59 | """ Default options to pass to Markdown for each test. """ |
| 60 | |
| 61 | def assertMarkdownRenders(self, source, expected, expected_attrs=None, **kwargs): |
| 62 | """ |
| 63 | Test that source Markdown text renders to expected output with given keywords. |
| 64 | |
| 65 | `expected_attrs` accepts a `dict`. Each key should be the name of an attribute |
| 66 | on the `Markdown` instance and the value should be the expected value after |
| 67 | the source text is parsed by Markdown. After the expected output is tested, |
| 68 | the expected value for each attribute is compared against the actual |
| 69 | attribute of the `Markdown` instance using `TestCase.assertEqual`. |
| 70 | """ |
| 71 | |
| 72 | expected_attrs = expected_attrs or {} |
| 73 | kws = self.default_kwargs.copy() |
| 74 | kws.update(kwargs) |
| 75 | md = Markdown(**kws) |
| 76 | output = md.convert(source) |
| 77 | self.assertMultiLineEqual(output, expected) |
| 78 | for key, value in expected_attrs.items(): |
| 79 | self.assertEqual(getattr(md, key), value) |
| 80 | |
| 81 | def dedent(self, text): |
| 82 | """ |
no test coverage detected