##// END OF EJS Templates
Fix tests in IPython.utils
Thomas Kluyver -
Show More
@@ -46,7 +46,7 b' class EvalDict:'
46 46
47 47 >>> text = "python"
48 48
49 >>> print "%(text.capitalize())s %(number/9.0).1f rules!" % EvalDict()
49 >>> print("%(text.capitalize())s %(number/9.0).1f rules!" % EvalDict())
50 50 Python 2.1 rules!
51 51 """
52 52
@@ -78,7 +78,7 b' class Struct(dict):'
78 78 >>> try:
79 79 ... s['b'] = 20
80 80 ... except KeyError:
81 ... print 'this is not allowed'
81 ... print('this is not allowed')
82 82 ...
83 83 this is not allowed
84 84 """
@@ -103,7 +103,7 b' class Struct(dict):'
103 103 >>> try:
104 104 ... s.get = 10
105 105 ... except AttributeError:
106 ... print "you can't set a class member"
106 ... print("you can't set a class member")
107 107 ...
108 108 you can't set a class member
109 109 """
@@ -139,7 +139,7 b' class Struct(dict):'
139 139 >>> try:
140 140 ... s.b
141 141 ... except AttributeError:
142 ... print "I don't have that key"
142 ... print("I don't have that key")
143 143 ...
144 144 I don't have that key
145 145 """
@@ -17,7 +17,7 b' class StrDispatch(object):'
17 17 >>> dis.add_s('hei',34, priority = 4)
18 18 >>> dis.add_s('hei',123, priority = 2)
19 19 >>> dis.add_re('h.i', 686)
20 >>> print list(dis.flat_matches('hei'))
20 >>> print(list(dis.flat_matches('hei')))
21 21 [123, 34, 686]
22 22 """
23 23
@@ -59,9 +59,8 b' class Tests (unittest.TestCase):'
59 59 ]
60 60 for pat,res in tests:
61 61 res.sort()
62 a=wildcard.list_namespace(ns,"all",pat,ignore_case=False,
63 show_all=False).keys()
64 a.sort()
62 a=sorted(wildcard.list_namespace(ns,"all",pat,ignore_case=False,
63 show_all=False).keys())
65 64 self.assertEqual(a,res)
66 65
67 66 def test_case_showall(self):
@@ -75,9 +74,8 b' class Tests (unittest.TestCase):'
75 74 ]
76 75 for pat,res in tests:
77 76 res.sort()
78 a=wildcard.list_namespace(ns,"all",pat,ignore_case=False,
79 show_all=True).keys()
80 a.sort()
77 a=sorted(wildcard.list_namespace(ns,"all",pat,ignore_case=False,
78 show_all=True).keys())
81 79 self.assertEqual(a,res)
82 80
83 81
@@ -93,9 +91,8 b' class Tests (unittest.TestCase):'
93 91 ]
94 92 for pat,res in tests:
95 93 res.sort()
96 a=wildcard.list_namespace(ns,"all",pat,ignore_case=True,
97 show_all=False).keys()
98 a.sort()
94 a=sorted(wildcard.list_namespace(ns,"all",pat,ignore_case=True,
95 show_all=False).keys())
99 96 self.assertEqual(a,res)
100 97
101 98 def test_nocase_showall(self):
@@ -110,8 +107,8 b' class Tests (unittest.TestCase):'
110 107 ]
111 108 for pat,res in tests:
112 109 res.sort()
113 a=wildcard.list_namespace(ns,"all",pat,ignore_case=True,
114 show_all=True).keys()
110 a=sorted(wildcard.list_namespace(ns,"all",pat,ignore_case=True,
111 show_all=True).keys())
115 112 a.sort()
116 113 self.assertEqual(a,res)
117 114
@@ -126,9 +123,8 b' class Tests (unittest.TestCase):'
126 123 ]
127 124 for pat, res in tests:
128 125 res.sort()
129 a = wildcard.list_namespace(ns, "all", pat, ignore_case=False,
130 show_all=True).keys()
131 a.sort()
126 a = sorted(wildcard.list_namespace(ns, "all", pat, ignore_case=False,
127 show_all=True).keys())
132 128 self.assertEqual(a, res)
133 129
134 130 def test_dict_dir(self):
General Comments 0
You need to be logged in to leave comments. Login now