diff --git a/IPython/utils/tests/test_wildcard.py b/IPython/utils/tests/test_wildcard.py index d2bc4df..20d459b 100644 --- a/IPython/utils/tests/test_wildcard.py +++ b/IPython/utils/tests/test_wildcard.py @@ -115,3 +115,19 @@ class Tests (unittest.TestCase): show_all=True).keys() a.sort() self.assertEqual(a,res) + + def test_dict_attributes(self): + """Dictionaries should be indexed by attributes, not by keys. This was + causing Github issue 129.""" + ns = {"az":{"king":55}, "pq":{1:0}} + tests = [ + ("a*", ["az"]), + ("az.k*", ["az.keys"]), + ("pq.k*", ["pq.keys"]) + ] + for pat, res in tests: + res.sort() + a = wildcard.list_namespace(ns, "all", pat, ignore_case=False, + show_all=True).keys() + a.sort() + self.assertEqual(a, res)