Conditions | 1 |
Total Lines | 54 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | from unittest import TestCase |
||
48 | def test_margin(self): |
||
49 | self.verify_conversion( |
||
50 | """ |
||
51 | --- |
||
52 | pandoc-latex-margin: |
||
53 | - classes: [left] |
||
54 | left: 1cm |
||
55 | - classes: [right] |
||
56 | right: 1cm |
||
57 | --- |
||
58 | |||
59 | ::: {.left latex-right-margin="2cm"} ::: |
||
60 | Content1 |
||
61 | ::::::::::::::: |
||
62 | |||
63 | ::: {.right latex-left-margin="2cm"} ::: |
||
64 | Content2 |
||
65 | ::::::::::::::: |
||
66 | |||
67 | ::: {latex-right-margin="2cm"} ::: |
||
68 | Content3 |
||
69 | ::::::::::::::: |
||
70 | |||
71 | ::: {latex-left-margin="2cm"} ::: |
||
72 | Content4 |
||
73 | ::::::::::::::: |
||
74 | |||
75 | """, |
||
76 | r""" |
||
77 | \begin{pandocchangemargin}{1cm}{2cm} |
||
78 | |||
79 | Content1 |
||
80 | |||
81 | \end{pandocchangemargin} |
||
82 | |||
83 | \begin{pandocchangemargin}{2cm}{1cm} |
||
84 | |||
85 | Content2 |
||
86 | |||
87 | \end{pandocchangemargin} |
||
88 | |||
89 | \begin{pandocchangemargin}{0pt}{2cm} |
||
90 | |||
91 | Content3 |
||
92 | |||
93 | \end{pandocchangemargin} |
||
94 | |||
95 | \begin{pandocchangemargin}{2cm}{0pt} |
||
96 | |||
97 | Content4 |
||
98 | |||
99 | \end{pandocchangemargin} |
||
100 | """, |
||
101 | pandoc_latex_margin.main, |
||
102 | ) |
||
103 |