##// END OF EJS Templates
Added test for _userlist_pprint...
007vedant -
Show More
@@ -5,7 +5,7 b''
5 5 # Distributed under the terms of the Modified BSD License.
6 6
7 7
8 from collections import Counter, defaultdict, deque, OrderedDict
8 from collections import Counter, defaultdict, deque, OrderedDict, UserList
9 9 import os
10 10 import pytest
11 11 import types
@@ -294,6 +294,42 b' def test_basic_class():'
294 294 assert type_pprint_wrapper.called is True
295 295
296 296
297 def test_collections_userlist():
298 # Create userlist with cycle
299 a = UserList()
300 a.append(a)
301
302 cases = [
303 (UserList(), "UserList([])"),
304 (
305 UserList(i for i in range(1000, 1020)),
306 "UserList([1000,\n"
307 " 1001,\n"
308 " 1002,\n"
309 " 1003,\n"
310 " 1004,\n"
311 " 1005,\n"
312 " 1006,\n"
313 " 1007,\n"
314 " 1008,\n"
315 " 1009,\n"
316 " 1010,\n"
317 " 1011,\n"
318 " 1012,\n"
319 " 1013,\n"
320 " 1014,\n"
321 " 1015,\n"
322 " 1016,\n"
323 " 1017,\n"
324 " 1018,\n"
325 " 1019])",
326 ),
327 (a, "UserList([UserList(...)])"),
328 ]
329 for obj, expected in cases:
330 assert pretty.pretty(obj) == expected
331
332
297 333 # TODO : pytest.mark.parametrise once nose is gone.
298 334 def test_collections_defaultdict():
299 335 # Create defaultdicts with cycles
General Comments 0
You need to be logged in to leave comments. Login now