##// END OF EJS Templates
Fixed reference to `tokens`
Jonathan Frederic -
Show More
@@ -1,92 +1,92 b''
1 1
2 2 """
3 3 Module with tests for Markdown
4 4 """
5 5
6 6 #-----------------------------------------------------------------------------
7 7 # Copyright (c) 2013, the IPython Development Team.
8 8 #
9 9 # Distributed under the terms of the Modified BSD License.
10 10 #
11 11 # The full license is in the file COPYING.txt, distributed with this software.
12 12 #-----------------------------------------------------------------------------
13 13
14 14 #-----------------------------------------------------------------------------
15 15 # Imports
16 16 #-----------------------------------------------------------------------------
17 17
18 18
19 19 from IPython.testing.decorators import onlyif_cmds_exist
20 20 from IPython.utils.py3compat import string_types
21 21
22 22 from ...tests.base import TestsBase
23 23 from ..markdown import *
24 24
25 25
26 26 #-----------------------------------------------------------------------------
27 27 # Class
28 28 #-----------------------------------------------------------------------------
29 29
30 30 class TestMarkdown(TestsBase):
31 31
32 32 tests = [
33 33 '*test',
34 34 '**test',
35 35 '*test*',
36 36 '_test_',
37 37 '__test__',
38 38 '__*test*__',
39 39 '**test**',
40 40 '#test',
41 41 '##test',
42 42 'test\n----',
43 43 'test [link](https://google.com/)']
44 44
45 45 tokens = [
46 46 '*test',
47 47 '**test',
48 48 'test',
49 49 'test',
50 50 'test',
51 51 'test',
52 52 'test',
53 53 'test',
54 54 'test',
55 55 'test',
56 56 ('test', 'https://google.com/')]
57 57
58 58
59 59 @onlyif_cmds_exist('pandoc')
60 60 def test_markdown2latex(self):
61 61 """
62 62 markdown2latex test
63 63 """
64 64 for index, test in enumerate(self.tests):
65 yield self._try_markdown, markdown2latex, test, tokens[index]
65 yield self._try_markdown, markdown2latex, test, self.tokens[index]
66 66
67 67
68 68 @onlyif_cmds_exist('pandoc')
69 69 def test_markdown2html(self):
70 70 """
71 71 markdown2html test
72 72 """
73 73 for index, test in enumerate(self.tests):
74 yield self._try_markdown, markdown2html, test, tokens[index]
74 yield self._try_markdown, markdown2html, test, self.tokens[index]
75 75
76 76
77 77 @onlyif_cmds_exist('pandoc')
78 78 def test_markdown2rst(self):
79 79 """
80 80 markdown2rst test
81 81 """
82 82 for index, test in enumerate(self.tests):
83 83 yield self._try_markdown, markdown2rst, test, tokens[index]
84 84
85 85
86 86 def _try_markdown(self, method, test, tokens):
87 87 results = method(test)
88 88 if isinstance(tokens, string_types):
89 89 assert tokens in results
90 90 else:
91 91 for token in tokens:
92 92 assert token in results
General Comments 0
You need to be logged in to leave comments. Login now