Conditions | 1 |
Total Lines | 39 |
Code Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | from unittest import TestCase |
||
8 | def verify_conversion( |
||
9 | self, |
||
10 | text, |
||
11 | expected, |
||
12 | transform, |
||
13 | input_format="markdown", |
||
14 | output_format="latex", |
||
15 | standalone=False, |
||
16 | ) -> None: |
||
17 | """ |
||
18 | Verify the conversion. |
||
19 | |||
20 | Parameters |
||
21 | ---------- |
||
22 | text |
||
23 | input text |
||
24 | expected |
||
25 | expected text |
||
26 | transform |
||
27 | filter function |
||
28 | input_format |
||
29 | input format |
||
30 | output_format |
||
31 | output format |
||
32 | standalone |
||
33 | is the output format standalone ? |
||
34 | """ |
||
35 | doc = convert_text(text, input_format=input_format, standalone=True) |
||
36 | doc.format = output_format |
||
37 | doc = transform(doc) |
||
38 | converted = convert_text( |
||
39 | doc.content, |
||
40 | input_format="panflute", |
||
41 | output_format=output_format, |
||
42 | extra_args=["--wrap=none"], |
||
43 | standalone=standalone, |
||
44 | ) |
||
45 | print(converted) |
||
46 | self.assertEqual(converted.strip(), expected.strip()) |
||
47 | |||
103 |