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