Dictionaries should be indexed by attributes, not by keys. This was causing Github issue 129.
(self)
| 234 | self.assertEqual(a, res) |
| 235 | |
| 236 | def test_dict_attributes(self): |
| 237 | """Dictionaries should be indexed by attributes, not by keys. This was |
| 238 | causing Github issue 129.""" |
| 239 | ns = {"az": {"king": 55}, "pq": {1: 0}} |
| 240 | tests = [("a*", ["az"]), ("az.k*", ["az.keys"]), ("pq.k*", ["pq.keys"])] |
| 241 | for pat, res in tests: |
| 242 | res.sort() |
| 243 | a = sorted( |
| 244 | wildcard.list_namespace( |
| 245 | ns, "all", pat, ignore_case=False, show_all=True |
| 246 | ).keys() |
| 247 | ) |
| 248 | self.assertEqual(a, res) |
| 249 | |
| 250 | def test_dict_dir(self): |
| 251 | class A(object): |