Passed
Push — develop ( bcdb14...7e0539 )
by Christophe
01:15
created

tests.test_referencing   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 99
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 15
dl 0
loc 99
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A ReferencincTest.test_referencing_standard() 0 19 1
A ReferencincTest.test_referencing_latex() 0 59 1
1
from unittest import TestCase
2
3
from .helper import verify_conversion
4
5
6
class ReferencincTest(TestCase):
7
    def test_referencing_standard(self):
8
        verify_conversion(
9
            self,
10
            r"""
11
Header
12
======
13
14
Section
15
-------
16
17
Exercise (First title) -.+.#exercise:first
18
19
Exercise (Second title) -.+.#exercise:second
20
21
See [%D %d %T %t %g %s %n # %c](#exercise:first)
22
23
See [%D %d %T %t %g %s %n # %c](#exercise:second)
24
            """,
25
            r"""
26
# Header
27
28
## Section
29
30
[]{#exercise:header.section.first-title}[**Exercise 1.1** *(First title)*]{#exercise:first .pandoc-numbering-text .exercise}
31
32
[]{#exercise:header.section.second-title}[**Exercise 1.2** *(Second title)*]{#exercise:second .pandoc-numbering-text .exercise}
33
34
See [Exercise exercise First title first title 1.1.1 1.1 1.1 1.1 2](#exercise:first)
35
36
See [Exercise exercise Second title second title 1.1.2 1.1 1.2 1.2 2](#exercise:second)
37
            """,
38
        )
39
40
    def test_referencing_latex(self):
41
        verify_conversion(
42
            self,
43
            r"""
44
Title
45
=====
46
47
Exercise -.#first
48
49
Exercise (Title) -.#second
50
51
See [%D %d %T %t %g %s %n # %c %p](#exercise:first)
52
53
See [%D %d %T %t %g %s %n # %c %p](#exercise:second)
54
            """,
55
            r"""
56
---
57
header-includes:
58
- |
59
  `
60
  \makeatletter
61
  \@ifpackageloaded{subfig}{
62
      \usepackage[subfigure]{tocloft}
63
  }{
64
      \usepackage{tocloft}
65
  }
66
  \makeatother
67
  `{=tex}
68
- "`\\usepackage{etoolbox}`{=tex}"
69
- "`\\ifdef{\\mainmatter}{\\let\\oldmainmatter\\mainmatter\\renewcommand{\\mainmatter}[0]{\\oldmainmatter}}{}`{=tex}"
70
---
71
72
`
73
\makeatletter
74
\@ifpackageloaded{subfig}{
75
    \usepackage[subfigure]{tocloft}
76
}{
77
    \usepackage{tocloft}
78
}
79
\makeatother
80
`{=tex}
81
82
`\usepackage{etoolbox}`{=tex}
83
84
`\ifdef{\mainmatter}{\let\oldmainmatter\mainmatter\renewcommand{\mainmatter}[0]{\oldmainmatter}}{}`{=tex}
85
86
`\ifdef{\mainmatter}{}{}`{=tex}
87
88
# Title
89
90
`\phantomsection\addcontentsline{exercise}{exercise}{\protect\numberline {1.1}{\ignorespaces {Exercise}}}`{=tex}[]{#exercise:title.1}[**Exercise 1**]{#exercise:first .pandoc-numbering-text .exercise}
91
92
`\phantomsection\addcontentsline{exercise}{exercise}{\protect\numberline {1.2}{\ignorespaces {Title}}}`{=tex}[]{#exercise:title.title}[**Exercise 2** *(Title)*]{#exercise:second .pandoc-numbering-text .exercise}
93
94
See [Exercise exercise 1.1 1 1 1 2 `\pageref{exercise:first}`{=tex}](#exercise:first)
95
96
See [Exercise exercise Title title 1.2 1 2 2 2 `\pageref{exercise:second}`{=tex}](#exercise:second)
97
            """,
98
            "latex",
99
        )
100