Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2dc36ad

Browse files
committed
start removing nose from IPython/lib/tests/test_display.py
1 parent 4aeedd3 commit 2dc36ad

1 file changed

Lines changed: 21 additions & 15 deletions

File tree

IPython/lib/tests/test_display.py

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ def test_existing_path_FileLink():
5959
tf = NamedTemporaryFile()
6060
fl = display.FileLink(tf.name)
6161
actual = fl._repr_html_()
62-
expected = "<a href='%s' target='_blank'>%s</a><br>" % (tf.name,tf.name)
63-
nt.assert_equal(actual,expected)
62+
expected = "<a href='%s' target='_blank'>%s</a><br>" % (tf.name, tf.name)
63+
assert actual == expected
64+
6465

6566
def test_existing_path_FileLink_repr():
6667
"""FileLink: Calling repr() functions as expected on existing filepath
@@ -69,7 +70,8 @@ def test_existing_path_FileLink_repr():
6970
fl = display.FileLink(tf.name)
7071
actual = repr(fl)
7172
expected = tf.name
72-
nt.assert_equal(actual,expected)
73+
assert actual == expected
74+
7375

7476
def test_error_on_directory_to_FileLink():
7577
"""FileLink: Raises error when passed directory
@@ -111,7 +113,8 @@ def test_existing_path_FileLinks():
111113
(tf1.name.replace("\\","/"),split(tf1.name)[1])]
112114
expected.sort()
113115
# We compare the sorted list of links here as that's more reliable
114-
nt.assert_equal(actual,expected)
116+
assert actual == expected
117+
115118

116119
def test_existing_path_FileLinks_alt_formatter():
117120
"""FileLinks: Calling _repr_html_ functions as expected w/ an alt formatter
@@ -128,7 +131,8 @@ def fake_formatter(dirname,fnames,included_suffixes):
128131
expected = ["hello","world"]
129132
expected.sort()
130133
# We compare the sorted list of links here as that's more reliable
131-
nt.assert_equal(actual,expected)
134+
assert actual == expected
135+
132136

133137
def test_existing_path_FileLinks_repr():
134138
"""FileLinks: Calling repr() functions as expected on existing directory """
@@ -142,8 +146,9 @@ def test_existing_path_FileLinks_repr():
142146
expected = ['%s/' % td, ' %s' % split(tf1.name)[1],' %s' % split(tf2.name)[1]]
143147
expected.sort()
144148
# We compare the sorted list of links here as that's more reliable
145-
nt.assert_equal(actual,expected)
146-
149+
assert actual == expected
150+
151+
147152
def test_existing_path_FileLinks_repr_alt_formatter():
148153
"""FileLinks: Calling repr() functions as expected w/ alt formatter
149154
"""
@@ -159,8 +164,9 @@ def fake_formatter(dirname,fnames,included_suffixes):
159164
expected = ["hello","world"]
160165
expected.sort()
161166
# We compare the sorted list of links here as that's more reliable
162-
nt.assert_equal(actual,expected)
163-
167+
assert actual == expected
168+
169+
164170
def test_error_on_file_to_FileLinks():
165171
"""FileLinks: Raises error when passed file
166172
"""
@@ -178,11 +184,11 @@ def test_recursive_FileLinks():
178184
fl = display.FileLinks(td)
179185
actual = str(fl)
180186
actual = actual.split('\n')
181-
nt.assert_equal(len(actual), 4, actual)
187+
assert len(actual) == 4, actual
182188
fl = display.FileLinks(td, recursive=False)
183189
actual = str(fl)
184190
actual = actual.split('\n')
185-
nt.assert_equal(len(actual), 2, actual)
191+
assert len(actual) == 2, actual
186192

187193
def test_audio_from_file():
188194
path = pjoin(dirname(__file__), 'test.wav')
@@ -194,13 +200,13 @@ class TestAudioDataWithNumpy(TestCase):
194200
def test_audio_from_numpy_array(self):
195201
test_tone = get_test_tone()
196202
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)
198204

199205
@skipif_not_numpy
200206
def test_audio_from_list(self):
201207
test_tone = get_test_tone()
202208
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)
204210

205211
@skipif_not_numpy
206212
def test_audio_from_numpy_array_without_rate_raises(self):
@@ -212,7 +218,7 @@ def test_audio_data_normalization(self):
212218
for scale in [1, 0.5, 2]:
213219
audio = display.Audio(get_test_tone(scale), rate=44100)
214220
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
216222

217223
@skipif_not_numpy
218224
def test_audio_data_without_normalization(self):
@@ -223,7 +229,7 @@ def test_audio_data_without_normalization(self):
223229
expected_max_value = int(max_int16 * test_tone_max_abs)
224230
audio = display.Audio(test_tone, rate=44100, normalize=False)
225231
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
227233

228234
def test_audio_data_without_normalization_raises_for_invalid_data(self):
229235
nt.assert_raises(

0 commit comments

Comments
 (0)