Show More
@@ -39,7 +39,7 b' class TestAnsi(TestsBase):' | |||||
39 | 'hello' : 'hello'} |
|
39 | 'hello' : 'hello'} | |
40 |
|
40 | |||
41 | for inval, outval in correct_outputs.items(): |
|
41 | for inval, outval in correct_outputs.items(): | |
42 |
|
|
42 | self._try_strip_ansi(inval, outval) | |
43 |
|
43 | |||
44 |
|
44 | |||
45 | def _try_strip_ansi(self, inval, outval): |
|
45 | def _try_strip_ansi(self, inval, outval): | |
@@ -58,7 +58,7 b' class TestAnsi(TestsBase):' | |||||
58 | 'hello' : 'hello'} |
|
58 | 'hello' : 'hello'} | |
59 |
|
59 | |||
60 | for inval, outval in correct_outputs.items(): |
|
60 | for inval, outval in correct_outputs.items(): | |
61 |
|
|
61 | self._try_ansi2html(inval, outval) | |
62 |
|
62 | |||
63 |
|
63 | |||
64 | def _try_ansi2html(self, inval, outval): |
|
64 | def _try_ansi2html(self, inval, outval): | |
@@ -77,7 +77,7 b' class TestAnsi(TestsBase):' | |||||
77 | 'hello' : 'hello'} |
|
77 | 'hello' : 'hello'} | |
78 |
|
78 | |||
79 | for inval, outval in correct_outputs.items(): |
|
79 | for inval, outval in correct_outputs.items(): | |
80 |
|
|
80 | self._try_ansi2latex(inval, outval) | |
81 |
|
81 | |||
82 |
|
82 | |||
83 | def _try_ansi2latex(self, inval, outval): |
|
83 | def _try_ansi2latex(self, inval, outval): |
@@ -49,13 +49,13 b' class TestHighlight(TestsBase):' | |||||
49 | def test_highlight2html(self): |
|
49 | def test_highlight2html(self): | |
50 | """highlight2html test""" |
|
50 | """highlight2html test""" | |
51 | for index, test in enumerate(self.tests): |
|
51 | for index, test in enumerate(self.tests): | |
52 |
|
|
52 | self._try_highlight(highlight2html, test, self.tokens[index]) | |
53 |
|
53 | |||
54 |
|
54 | |||
55 | def test_highlight2latex(self): |
|
55 | def test_highlight2latex(self): | |
56 | """highlight2latex test""" |
|
56 | """highlight2latex test""" | |
57 | for index, test in enumerate(self.tests): |
|
57 | for index, test in enumerate(self.tests): | |
58 |
|
|
58 | self._try_highlight(highlight2latex, test, self.tokens[index]) | |
59 |
|
59 | |||
60 |
|
60 | |||
61 | def _try_highlight(self, method, test, tokens): |
|
61 | def _try_highlight(self, method, test, tokens): |
@@ -35,7 +35,7 b' class TestLatex(TestsBase):' | |||||
35 | ('','')] |
|
35 | ('','')] | |
36 |
|
36 | |||
37 | for test in tests: |
|
37 | for test in tests: | |
38 |
|
|
38 | self._try_escape_latex(test[0], test[1]) | |
39 |
|
39 | |||
40 |
|
40 | |||
41 | def _try_escape_latex(self, test, result): |
|
41 | def _try_escape_latex(self, test, result): | |
@@ -56,7 +56,7 b' class TestLatex(TestsBase):' | |||||
56 | ('','')] |
|
56 | ('','')] | |
57 |
|
57 | |||
58 | for test in tests: |
|
58 | for test in tests: | |
59 |
|
|
59 | self._try_strip_math_space(test[0], test[1]) | |
60 |
|
60 | |||
61 |
|
61 | |||
62 | def _try_strip_math_space(self, test, result): |
|
62 | def _try_strip_math_space(self, test, result): |
@@ -61,14 +61,14 b' class TestMarkdown(TestsBase):' | |||||
61 | def test_markdown2latex(self): |
|
61 | def test_markdown2latex(self): | |
62 | """markdown2latex test""" |
|
62 | """markdown2latex test""" | |
63 | for index, test in enumerate(self.tests): |
|
63 | for index, test in enumerate(self.tests): | |
64 |
|
|
64 | self._try_markdown(markdown2latex, test, self.tokens[index]) | |
65 |
|
65 | |||
66 |
|
66 | |||
67 | @dec.onlyif_cmds_exist('pandoc') |
|
67 | @dec.onlyif_cmds_exist('pandoc') | |
68 | def test_markdown2html(self): |
|
68 | def test_markdown2html(self): | |
69 | """markdown2html test""" |
|
69 | """markdown2html test""" | |
70 | for index, test in enumerate(self.tests): |
|
70 | for index, test in enumerate(self.tests): | |
71 |
|
|
71 | self._try_markdown(markdown2html, test, self.tokens[index]) | |
72 |
|
72 | |||
73 |
|
73 | |||
74 | @dec.onlyif_cmds_exist('pandoc') |
|
74 | @dec.onlyif_cmds_exist('pandoc') | |
@@ -81,7 +81,7 b' class TestMarkdown(TestsBase):' | |||||
81 | tokens[1] = r'\*\*test' |
|
81 | tokens[1] = r'\*\*test' | |
82 |
|
82 | |||
83 | for index, test in enumerate(self.tests): |
|
83 | for index, test in enumerate(self.tests): | |
84 |
|
|
84 | self._try_markdown(markdown2rst, test, tokens[index]) | |
85 |
|
85 | |||
86 |
|
86 | |||
87 | def _try_markdown(self, method, test, tokens): |
|
87 | def _try_markdown(self, method, test, tokens): |
@@ -36,7 +36,7 b' class TestStrings(TestsBase):' | |||||
36 | As if the strings were thine, shouldst know of this. |
|
36 | As if the strings were thine, shouldst know of this. | |
37 | """ |
|
37 | """ | |
38 | for length in [30,5,1]: |
|
38 | for length in [30,5,1]: | |
39 |
|
|
39 | self._confirm_wrap_text(test_text, length) | |
40 |
|
40 | |||
41 |
|
41 | |||
42 | def _confirm_wrap_text(self, text, length): |
|
42 | def _confirm_wrap_text(self, text, length): | |
@@ -73,7 +73,7 b' class TestStrings(TestsBase):' | |||||
73 | ('Hello', 'Hello'), |
|
73 | ('Hello', 'Hello'), | |
74 | ('W$o$rld', 'W$o$rld')] |
|
74 | ('W$o$rld', 'W$o$rld')] | |
75 | for test in tests: |
|
75 | for test in tests: | |
76 |
|
|
76 | self._try_strip_dollars(test[0], test[1]) | |
77 |
|
77 | |||
78 |
|
78 | |||
79 | def _try_strip_dollars(self, test, result): |
|
79 | def _try_strip_dollars(self, test, result): | |
@@ -89,7 +89,7 b' class TestStrings(TestsBase):' | |||||
89 | ('My files are in `files/`', 'My files are in `files/`'), |
|
89 | ('My files are in `files/`', 'My files are in `files/`'), | |
90 | ('<a href="files/test.html">files/test.html</a>', '<a href="test.html">files/test.html</a>')] |
|
90 | ('<a href="files/test.html">files/test.html</a>', '<a href="test.html">files/test.html</a>')] | |
91 | for test in tests: |
|
91 | for test in tests: | |
92 |
|
|
92 | self._try_files_prefix(test[0], test[1]) | |
93 |
|
93 | |||
94 |
|
94 | |||
95 | def _try_files_prefix(self, test, result): |
|
95 | def _try_files_prefix(self, test, result): |
@@ -16,12 +16,12 b' Contains base test class for nbconvert' | |||||
16 | import os |
|
16 | import os | |
17 | import glob |
|
17 | import glob | |
18 | import shutil |
|
18 | import shutil | |
|
19 | import unittest | |||
19 |
|
20 | |||
20 | import IPython |
|
21 | import IPython | |
21 | from IPython.utils.tempdir import TemporaryWorkingDirectory |
|
22 | from IPython.utils.tempdir import TemporaryWorkingDirectory | |
22 | from IPython.utils.process import get_output_error_code |
|
23 | from IPython.utils.process import get_output_error_code | |
23 | from IPython.testing.tools import get_ipython_cmd |
|
24 | from IPython.testing.tools import get_ipython_cmd | |
24 | from IPython.testing.ipunittest import ParametricTestCase |
|
|||
25 |
|
25 | |||
26 | # a trailing space allows for simpler concatenation with the other arguments |
|
26 | # a trailing space allows for simpler concatenation with the other arguments | |
27 | ipy_cmd = get_ipython_cmd(as_string=True) + " " |
|
27 | ipy_cmd = get_ipython_cmd(as_string=True) + " " | |
@@ -31,7 +31,7 b' ipy_cmd = get_ipython_cmd(as_string=True) + " "' | |||||
31 | #----------------------------------------------------------------------------- |
|
31 | #----------------------------------------------------------------------------- | |
32 |
|
32 | |||
33 |
|
33 | |||
34 |
class TestsBase( |
|
34 | class TestsBase(unittest.TestCase): | |
35 | """Base tests class. Contains useful fuzzy comparison and nbconvert |
|
35 | """Base tests class. Contains useful fuzzy comparison and nbconvert | |
36 | functions.""" |
|
36 | functions.""" | |
37 |
|
37 | |||
@@ -86,7 +86,7 b' class TestsBase(ParametricTestCase):' | |||||
86 |
|
86 | |||
87 | For example: |
|
87 | For example: | |
88 | Replace "ii" with "i" in the string "Hiiii" yields "Hii" |
|
88 | Replace "ii" with "i" in the string "Hiiii" yields "Hii" | |
89 |
Another replacement |
|
89 | Another replacement cds "Hi" (the desired output) | |
90 |
|
90 | |||
91 | Parameters: |
|
91 | Parameters: | |
92 | ----------- |
|
92 | ----------- |
General Comments 0
You need to be logged in to leave comments.
Login now