##// END OF EJS Templates
remove some nose from test_capture.py
Matthias Bussonnier -
Show More
@@ -15,7 +15,6 b''
15
15
16 import sys
16 import sys
17
17
18 import nose.tools as nt
19 import pytest
18 import pytest
20
19
21 from IPython.testing.decorators import skip_iptest_but_not_pytest
20 from IPython.testing.decorators import skip_iptest_but_not_pytest
@@ -75,18 +74,18 b' def test_rich_output_empty(method_mime):'
75 """RichOutput with no args"""
74 """RichOutput with no args"""
76 rich = capture.RichOutput()
75 rich = capture.RichOutput()
77 method, mime = method_mime
76 method, mime = method_mime
78 nt.assert_equal(getattr(rich, method)(), None)
77 assert getattr(rich, method)() is None
79
78
80 def test_rich_output():
79 def test_rich_output():
81 """test RichOutput basics"""
80 """test RichOutput basics"""
82 data = basic_data
81 data = basic_data
83 metadata = basic_metadata
82 metadata = basic_metadata
84 rich = capture.RichOutput(data=data, metadata=metadata)
83 rich = capture.RichOutput(data=data, metadata=metadata)
85 nt.assert_equal(rich._repr_html_(), data["text/html"])
84 assert rich._repr_html_() == data["text/html"]
86 nt.assert_equal(rich._repr_png_(), (data["image/png"], metadata["image/png"]))
85 assert rich._repr_png_() == (data["image/png"], metadata["image/png"])
87 nt.assert_equal(rich._repr_latex_(), None)
86 assert rich._repr_latex_() is None
88 nt.assert_equal(rich._repr_javascript_(), None)
87 assert rich._repr_javascript_() is None
89 nt.assert_equal(rich._repr_svg_(), None)
88 assert rich._repr_svg_() is None
90
89
91
90
92 @skip_iptest_but_not_pytest
91 @skip_iptest_but_not_pytest
@@ -96,7 +95,7 b' def test_rich_output_no_metadata(method_mime):'
96 data = full_data
95 data = full_data
97 rich = capture.RichOutput(data=data)
96 rich = capture.RichOutput(data=data)
98 method, mime = method_mime
97 method, mime = method_mime
99 nt.assert_equal(getattr(rich, method)(), data[mime])
98 assert getattr(rich, method)() == data[mime]
100
99
101
100
102 @skip_iptest_but_not_pytest
101 @skip_iptest_but_not_pytest
@@ -107,7 +106,7 b' def test_rich_output_metadata(method_mime):'
107 metadata = full_metadata
106 metadata = full_metadata
108 rich = capture.RichOutput(data=data, metadata=metadata)
107 rich = capture.RichOutput(data=data, metadata=metadata)
109 method, mime = method_mime
108 method, mime = method_mime
110 nt.assert_equal(getattr(rich, method)(), (data[mime], metadata[mime]))
109 assert getattr(rich, method)() == (data[mime], metadata[mime])
111
110
112 def test_rich_output_display():
111 def test_rich_output_display():
113 """test RichOutput.display
112 """test RichOutput.display
@@ -119,10 +118,10 b' def test_rich_output_display():'
119 rich = capture.RichOutput(data=data)
118 rich = capture.RichOutput(data=data)
120 with capture.capture_output() as cap:
119 with capture.capture_output() as cap:
121 rich.display()
120 rich.display()
122 nt.assert_equal(len(cap.outputs), 1)
121 assert len(cap.outputs) == 1
123 rich2 = cap.outputs[0]
122 rich2 = cap.outputs[0]
124 nt.assert_equal(rich2.data, rich.data)
123 assert rich2.data == rich.data
125 nt.assert_equal(rich2.metadata, rich.metadata)
124 assert rich2.metadata == rich.metadata
126
125
127 def test_capture_output():
126 def test_capture_output():
128 """capture_output works"""
127 """capture_output works"""
@@ -131,8 +130,8 b' def test_capture_output():'
131 print(hello_stdout, end="")
130 print(hello_stdout, end="")
132 print(hello_stderr, end="", file=sys.stderr)
131 print(hello_stderr, end="", file=sys.stderr)
133 rich.display()
132 rich.display()
134 nt.assert_equal(hello_stdout, cap.stdout)
133 assert hello_stdout == cap.stdout
135 nt.assert_equal(hello_stderr, cap.stderr)
134 assert hello_stderr == cap.stderr
136
135
137
136
138 def test_capture_output_no_stdout():
137 def test_capture_output_no_stdout():
@@ -142,9 +141,9 b' def test_capture_output_no_stdout():'
142 print(hello_stdout, end="")
141 print(hello_stdout, end="")
143 print(hello_stderr, end="", file=sys.stderr)
142 print(hello_stderr, end="", file=sys.stderr)
144 rich.display()
143 rich.display()
145 nt.assert_equal("", cap.stdout)
144 assert "" == cap.stdout
146 nt.assert_equal(hello_stderr, cap.stderr)
145 assert hello_stderr == cap.stderr
147 nt.assert_equal(len(cap.outputs), 1)
146 assert len(cap.outputs) == 1
148
147
149
148
150 def test_capture_output_no_stderr():
149 def test_capture_output_no_stderr():
@@ -155,9 +154,9 b' def test_capture_output_no_stderr():'
155 print(hello_stdout, end="")
154 print(hello_stdout, end="")
156 print(hello_stderr, end="", file=sys.stderr)
155 print(hello_stderr, end="", file=sys.stderr)
157 rich.display()
156 rich.display()
158 nt.assert_equal(hello_stdout, cap.stdout)
157 assert hello_stdout == cap.stdout
159 nt.assert_equal("", cap.stderr)
158 assert "" == cap.stderr
160 nt.assert_equal(len(cap.outputs), 1)
159 assert len(cap.outputs) == 1
161
160
162
161
163 def test_capture_output_no_display():
162 def test_capture_output_no_display():
@@ -167,6 +166,6 b' def test_capture_output_no_display():'
167 print(hello_stdout, end="")
166 print(hello_stdout, end="")
168 print(hello_stderr, end="", file=sys.stderr)
167 print(hello_stderr, end="", file=sys.stderr)
169 rich.display()
168 rich.display()
170 nt.assert_equal(hello_stdout, cap.stdout)
169 assert hello_stdout == cap.stdout
171 nt.assert_equal(hello_stderr, cap.stderr)
170 assert hello_stderr == cap.stderr
172 nt.assert_equal(cap.outputs, [])
171 assert cap.outputs == []
General Comments 0
You need to be logged in to leave comments. Login now