From 581b2352974ed6d610fde7bedc7ec32c3f41985f 2011-02-23 13:16:58 From: Thomas Kluyver Date: 2011-02-23 13:16:58 Subject: [PATCH] Add test for dict_dir method in utils.wildcard --- diff --git a/IPython/utils/tests/test_wildcard.py b/IPython/utils/tests/test_wildcard.py index 20d459b..7c5cff5 100644 --- a/IPython/utils/tests/test_wildcard.py +++ b/IPython/utils/tests/test_wildcard.py @@ -131,3 +131,18 @@ class Tests (unittest.TestCase): show_all=True).keys() a.sort() self.assertEqual(a, res) + + def test_dict_dir(self): + class A(object): + def __init__(self): + self.a = 1 + self.b = 2 + def __getattribute__(self, name): + if name=="a": + raise AttributeError + return object.__getattribute__(self, name) + + a = A() + adict = wildcard.dict_dir(a) + assert "a" not in adict # change to assertNotIn method in >= 2.7 + self.assertEqual(adict["b"], 2)