##// END OF EJS Templates
start removing nose from IPython/lib/tests/test_display.py
Matthias Bussonnier -
Show More
@@ -60,7 +60,8 b' def test_existing_path_FileLink():'
60 60 fl = display.FileLink(tf.name)
61 61 actual = fl._repr_html_()
62 62 expected = "<a href='%s' target='_blank'>%s</a><br>" % (tf.name,tf.name)
63 nt.assert_equal(actual,expected)
63 assert actual == expected
64
64 65
65 66 def test_existing_path_FileLink_repr():
66 67 """FileLink: Calling repr() functions as expected on existing filepath
@@ -69,7 +70,8 b' def test_existing_path_FileLink_repr():'
69 70 fl = display.FileLink(tf.name)
70 71 actual = repr(fl)
71 72 expected = tf.name
72 nt.assert_equal(actual,expected)
73 assert actual == expected
74
73 75
74 76 def test_error_on_directory_to_FileLink():
75 77 """FileLink: Raises error when passed directory
@@ -111,7 +113,8 b' def test_existing_path_FileLinks():'
111 113 (tf1.name.replace("\\","/"),split(tf1.name)[1])]
112 114 expected.sort()
113 115 # We compare the sorted list of links here as that's more reliable
114 nt.assert_equal(actual,expected)
116 assert actual == expected
117
115 118
116 119 def test_existing_path_FileLinks_alt_formatter():
117 120 """FileLinks: Calling _repr_html_ functions as expected w/ an alt formatter
@@ -128,7 +131,8 b' def test_existing_path_FileLinks_alt_formatter():'
128 131 expected = ["hello","world"]
129 132 expected.sort()
130 133 # We compare the sorted list of links here as that's more reliable
131 nt.assert_equal(actual,expected)
134 assert actual == expected
135
132 136
133 137 def test_existing_path_FileLinks_repr():
134 138 """FileLinks: Calling repr() functions as expected on existing directory """
@@ -142,7 +146,8 b' def test_existing_path_FileLinks_repr():'
142 146 expected = ['%s/' % td, ' %s' % split(tf1.name)[1],' %s' % split(tf2.name)[1]]
143 147 expected.sort()
144 148 # We compare the sorted list of links here as that's more reliable
145 nt.assert_equal(actual,expected)
149 assert actual == expected
150
146 151
147 152 def test_existing_path_FileLinks_repr_alt_formatter():
148 153 """FileLinks: Calling repr() functions as expected w/ alt formatter
@@ -159,7 +164,8 b' def test_existing_path_FileLinks_repr_alt_formatter():'
159 164 expected = ["hello","world"]
160 165 expected.sort()
161 166 # We compare the sorted list of links here as that's more reliable
162 nt.assert_equal(actual,expected)
167 assert actual == expected
168
163 169
164 170 def test_error_on_file_to_FileLinks():
165 171 """FileLinks: Raises error when passed file
@@ -178,11 +184,11 b' def test_recursive_FileLinks():'
178 184 fl = display.FileLinks(td)
179 185 actual = str(fl)
180 186 actual = actual.split('\n')
181 nt.assert_equal(len(actual), 4, actual)
187 assert len(actual) == 4, actual
182 188 fl = display.FileLinks(td, recursive=False)
183 189 actual = str(fl)
184 190 actual = actual.split('\n')
185 nt.assert_equal(len(actual), 2, actual)
191 assert len(actual) == 2, actual
186 192
187 193 def test_audio_from_file():
188 194 path = pjoin(dirname(__file__), 'test.wav')
@@ -194,13 +200,13 b' class TestAudioDataWithNumpy(TestCase):'
194 200 def test_audio_from_numpy_array(self):
195 201 test_tone = get_test_tone()
196 202 audio = display.Audio(test_tone, rate=44100)
197 nt.assert_equal(len(read_wav(audio.data)), len(test_tone))
203 assert len(read_wav(audio.data)) == len(test_tone)
198 204
199 205 @skipif_not_numpy
200 206 def test_audio_from_list(self):
201 207 test_tone = get_test_tone()
202 208 audio = display.Audio(list(test_tone), rate=44100)
203 nt.assert_equal(len(read_wav(audio.data)), len(test_tone))
209 assert len(read_wav(audio.data)) == len(test_tone)
204 210
205 211 @skipif_not_numpy
206 212 def test_audio_from_numpy_array_without_rate_raises(self):
@@ -212,7 +218,7 b' class TestAudioDataWithNumpy(TestCase):'
212 218 for scale in [1, 0.5, 2]:
213 219 audio = display.Audio(get_test_tone(scale), rate=44100)
214 220 actual_max_value = numpy.max(numpy.abs(read_wav(audio.data)))
215 nt.assert_equal(actual_max_value, expected_max_value)
221 assert actual_max_value == expected_max_value
216 222
217 223 @skipif_not_numpy
218 224 def test_audio_data_without_normalization(self):
@@ -223,7 +229,7 b' class TestAudioDataWithNumpy(TestCase):'
223 229 expected_max_value = int(max_int16 * test_tone_max_abs)
224 230 audio = display.Audio(test_tone, rate=44100, normalize=False)
225 231 actual_max_value = numpy.max(numpy.abs(read_wav(audio.data)))
226 nt.assert_equal(actual_max_value, expected_max_value)
232 assert actual_max_value == expected_max_value
227 233
228 234 def test_audio_data_without_normalization_raises_for_invalid_data(self):
229 235 nt.assert_raises(
General Comments 0
You need to be logged in to leave comments. Login now