Show More
@@ -131,3 +131,18 b' class Tests (unittest.TestCase):' | |||
|
131 | 131 | show_all=True).keys() |
|
132 | 132 | a.sort() |
|
133 | 133 | self.assertEqual(a, res) |
|
134 | ||
|
135 | def test_dict_dir(self): | |
|
136 | class A(object): | |
|
137 | def __init__(self): | |
|
138 | self.a = 1 | |
|
139 | self.b = 2 | |
|
140 | def __getattribute__(self, name): | |
|
141 | if name=="a": | |
|
142 | raise AttributeError | |
|
143 | return object.__getattribute__(self, name) | |
|
144 | ||
|
145 | a = A() | |
|
146 | adict = wildcard.dict_dir(a) | |
|
147 | assert "a" not in adict # change to assertNotIn method in >= 2.7 | |
|
148 | self.assertEqual(adict["b"], 2) |
General Comments 0
You need to be logged in to leave comments.
Login now