Show More
@@ -14,6 +14,7 b' Module with tests for ansi filters' | |||||
14 | # Imports |
|
14 | # Imports | |
15 | #----------------------------------------------------------------------------- |
|
15 | #----------------------------------------------------------------------------- | |
16 |
|
16 | |||
|
17 | from IPython.testing import decorators as dec | |||
17 | from IPython.utils.coloransi import TermColors |
|
18 | from IPython.utils.coloransi import TermColors | |
18 |
|
19 | |||
19 | from ...tests.base import TestsBase |
|
20 | from ...tests.base import TestsBase | |
@@ -27,7 +28,7 b' from ..ansi import strip_ansi, ansi2html, ansi2latex' | |||||
27 | class TestAnsi(TestsBase): |
|
28 | class TestAnsi(TestsBase): | |
28 | """Contains test functions for ansi.py""" |
|
29 | """Contains test functions for ansi.py""" | |
29 |
|
30 | |||
30 |
|
31 | @dec.parametric | ||
31 | def test_strip_ansi(self): |
|
32 | def test_strip_ansi(self): | |
32 | """strip_ansi test""" |
|
33 | """strip_ansi test""" | |
33 | correct_outputs = { |
|
34 | correct_outputs = { | |
@@ -47,6 +48,7 b' class TestAnsi(TestsBase):' | |||||
47 | self.assert_equal(outval, strip_ansi(inval)) |
|
48 | self.assert_equal(outval, strip_ansi(inval)) | |
48 |
|
49 | |||
49 |
|
50 | |||
|
51 | @dec.parametric | |||
50 | def test_ansi2html(self): |
|
52 | def test_ansi2html(self): | |
51 | """ansi2html test""" |
|
53 | """ansi2html test""" | |
52 | correct_outputs = { |
|
54 | correct_outputs = { | |
@@ -66,6 +68,7 b' class TestAnsi(TestsBase):' | |||||
66 | self.fuzzy_compare(outval, ansi2html(inval)) |
|
68 | self.fuzzy_compare(outval, ansi2html(inval)) | |
67 |
|
69 | |||
68 |
|
70 | |||
|
71 | @dec.parametric | |||
69 | def test_ansi2latex(self): |
|
72 | def test_ansi2latex(self): | |
70 | """ansi2latex test""" |
|
73 | """ansi2latex test""" | |
71 | correct_outputs = { |
|
74 | correct_outputs = { |
@@ -14,6 +14,7 b' Module with tests for Highlight' | |||||
14 | # Imports |
|
14 | # Imports | |
15 | #----------------------------------------------------------------------------- |
|
15 | #----------------------------------------------------------------------------- | |
16 |
|
16 | |||
|
17 | from IPython.testing import decorators as dec | |||
17 |
|
18 | |||
18 | from ...tests.base import TestsBase |
|
19 | from ...tests.base import TestsBase | |
19 | from ..highlight import highlight2html, highlight2latex |
|
20 | from ..highlight import highlight2html, highlight2latex | |
@@ -47,12 +48,14 b' class TestHighlight(TestsBase):' | |||||
47 | ['pylab', 'plot']] |
|
48 | ['pylab', 'plot']] | |
48 |
|
49 | |||
49 |
|
50 | |||
|
51 | @dec.parametric | |||
50 | def test_highlight2html(self): |
|
52 | def test_highlight2html(self): | |
51 | """highlight2html test""" |
|
53 | """highlight2html test""" | |
52 | for index, test in enumerate(self.tests): |
|
54 | for index, test in enumerate(self.tests): | |
53 | yield self._try_highlight, highlight2html, test, self.tokens[index] |
|
55 | yield self._try_highlight, highlight2html, test, self.tokens[index] | |
54 |
|
56 | |||
55 |
|
57 | |||
|
58 | @dec.parametric | |||
56 | def test_highlight2latex(self): |
|
59 | def test_highlight2latex(self): | |
57 | """highlight2latex test""" |
|
60 | """highlight2latex test""" | |
58 | for index, test in enumerate(self.tests): |
|
61 | for index, test in enumerate(self.tests): |
@@ -14,6 +14,7 b' Module with tests for Latex' | |||||
14 | # Imports |
|
14 | # Imports | |
15 | #----------------------------------------------------------------------------- |
|
15 | #----------------------------------------------------------------------------- | |
16 |
|
16 | |||
|
17 | from IPython.testing import decorators as dec | |||
17 |
|
18 | |||
18 | from ...tests.base import TestsBase |
|
19 | from ...tests.base import TestsBase | |
19 | from ..latex import escape_latex, strip_math_space |
|
20 | from ..latex import escape_latex, strip_math_space | |
@@ -26,6 +27,7 b' from ..latex import escape_latex, strip_math_space' | |||||
26 | class TestLatex(TestsBase): |
|
27 | class TestLatex(TestsBase): | |
27 |
|
28 | |||
28 |
|
29 | |||
|
30 | @dec.parametric | |||
29 | def test_escape_latex(self): |
|
31 | def test_escape_latex(self): | |
30 | """escape_latex test""" |
|
32 | """escape_latex test""" | |
31 | tests = [ |
|
33 | tests = [ | |
@@ -43,6 +45,7 b' class TestLatex(TestsBase):' | |||||
43 | self.assert_equal(escape_latex(test), result) |
|
45 | self.assert_equal(escape_latex(test), result) | |
44 |
|
46 | |||
45 |
|
47 | |||
|
48 | @dec.parametric | |||
46 | def test_strip_math_space(self): |
|
49 | def test_strip_math_space(self): | |
47 | """strip_math_space test""" |
|
50 | """strip_math_space test""" | |
48 | tests = [ |
|
51 | tests = [ |
@@ -17,8 +17,8 b' Module with tests for Markdown' | |||||
17 |
|
17 | |||
18 | from copy import copy |
|
18 | from copy import copy | |
19 |
|
19 | |||
20 | from IPython.testing.decorators import onlyif_cmds_exist |
|
|||
21 | from IPython.utils.py3compat import string_types |
|
20 | from IPython.utils.py3compat import string_types | |
|
21 | from IPython.testing import decorators as dec | |||
22 |
|
22 | |||
23 | from ...tests.base import TestsBase |
|
23 | from ...tests.base import TestsBase | |
24 | from ..markdown import markdown2latex, markdown2html, markdown2rst |
|
24 | from ..markdown import markdown2latex, markdown2html, markdown2rst | |
@@ -57,21 +57,24 b' class TestMarkdown(TestsBase):' | |||||
57 | ('test', 'https://google.com/')] |
|
57 | ('test', 'https://google.com/')] | |
58 |
|
58 | |||
59 |
|
59 | |||
60 | @onlyif_cmds_exist('pandoc') |
|
60 | @dec.onlyif_cmds_exist('pandoc') | |
|
61 | @dec.parametric | |||
61 | def test_markdown2latex(self): |
|
62 | def test_markdown2latex(self): | |
62 | """markdown2latex test""" |
|
63 | """markdown2latex test""" | |
63 | for index, test in enumerate(self.tests): |
|
64 | for index, test in enumerate(self.tests): | |
64 | yield self._try_markdown, markdown2latex, test, self.tokens[index] |
|
65 | yield self._try_markdown, markdown2latex, test, self.tokens[index] | |
65 |
|
66 | |||
66 |
|
67 | |||
67 | @onlyif_cmds_exist('pandoc') |
|
68 | @dec.onlyif_cmds_exist('pandoc') | |
|
69 | @dec.parametric | |||
68 | def test_markdown2html(self): |
|
70 | def test_markdown2html(self): | |
69 | """markdown2html test""" |
|
71 | """markdown2html test""" | |
70 | for index, test in enumerate(self.tests): |
|
72 | for index, test in enumerate(self.tests): | |
71 | yield self._try_markdown, markdown2html, test, self.tokens[index] |
|
73 | yield self._try_markdown, markdown2html, test, self.tokens[index] | |
72 |
|
74 | |||
73 |
|
75 | |||
74 | @onlyif_cmds_exist('pandoc') |
|
76 | @dec.onlyif_cmds_exist('pandoc') | |
|
77 | @dec.parametric | |||
75 | def test_markdown2rst(self): |
|
78 | def test_markdown2rst(self): | |
76 | """markdown2rst test""" |
|
79 | """markdown2rst test""" | |
77 |
|
80 |
@@ -14,6 +14,7 b' Module with tests for Strings' | |||||
14 | # Imports |
|
14 | # Imports | |
15 | #----------------------------------------------------------------------------- |
|
15 | #----------------------------------------------------------------------------- | |
16 |
|
16 | |||
|
17 | from IPython.testing import decorators as dec | |||
17 | from ...tests.base import TestsBase |
|
18 | from ...tests.base import TestsBase | |
18 | from ..strings import (wrap_text, html2text, add_anchor, strip_dollars, |
|
19 | from ..strings import (wrap_text, html2text, add_anchor, strip_dollars, | |
19 | strip_files_prefix, get_lines, comment_lines, ipython2python) |
|
20 | strip_files_prefix, get_lines, comment_lines, ipython2python) | |
@@ -25,6 +26,7 b' from ..strings import (wrap_text, html2text, add_anchor, strip_dollars,' | |||||
25 |
|
26 | |||
26 | class TestStrings(TestsBase): |
|
27 | class TestStrings(TestsBase): | |
27 |
|
28 | |||
|
29 | @dec.parametric | |||
28 | def test_wrap_text(self): |
|
30 | def test_wrap_text(self): | |
29 | """wrap_text test""" |
|
31 | """wrap_text test""" | |
30 | test_text = """ |
|
32 | test_text = """ | |
@@ -35,10 +37,12 b' class TestStrings(TestsBase):' | |||||
35 | for length in [30,5,1]: |
|
37 | for length in [30,5,1]: | |
36 | yield self._confirm_wrap_text, test_text, length |
|
38 | yield self._confirm_wrap_text, test_text, length | |
37 |
|
39 | |||
|
40 | ||||
38 | def _confirm_wrap_text(self, text, length): |
|
41 | def _confirm_wrap_text(self, text, length): | |
39 | for line in wrap_text(text, length).split('\n'): |
|
42 | for line in wrap_text(text, length).split('\n'): | |
40 | assert len(line) <= length |
|
43 | assert len(line) <= length | |
41 |
|
44 | |||
|
45 | ||||
42 | def test_html2text(self): |
|
46 | def test_html2text(self): | |
43 | """html2text test""" |
|
47 | """html2text test""" | |
44 | #TODO: More tests |
|
48 | #TODO: More tests | |
@@ -56,6 +60,7 b' class TestStrings(TestsBase):' | |||||
56 | assert '</b>' in results |
|
60 | assert '</b>' in results | |
57 |
|
61 | |||
58 |
|
62 | |||
|
63 | @dec.parametric | |||
59 | def test_strip_dollars(self): |
|
64 | def test_strip_dollars(self): | |
60 | """strip_dollars test""" |
|
65 | """strip_dollars test""" | |
61 | tests = [ |
|
66 | tests = [ | |
@@ -75,6 +80,7 b' class TestStrings(TestsBase):' | |||||
75 | self.assert_equal(strip_dollars(test), result) |
|
80 | self.assert_equal(strip_dollars(test), result) | |
76 |
|
81 | |||
77 |
|
82 | |||
|
83 | @dec.parametric | |||
78 | def test_strip_files_prefix(self): |
|
84 | def test_strip_files_prefix(self): | |
79 | """strip_files_prefix test""" |
|
85 | """strip_files_prefix test""" | |
80 | tests = [ |
|
86 | tests = [ |
General Comments 0
You need to be logged in to leave comments.
Login now