We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4a5e6c9 commit d1d9fd9Copy full SHA for d1d9fd9
Lib/test/test_descr.py
@@ -6261,5 +6261,23 @@ class IntSubclass(int):
6261
weakref_descriptor.__get__(IntSubclass(), IntSubclass)
6262
6263
6264
+class TestGetItemAttributeFallback(unittest.TestCase):
6265
+
6266
+ def test_attribute_fallback_for_configview(self):
6267
+ class ConfigView:
6268
+ def __init__(self, target):
6269
+ self.target = target
6270
6271
+ def __getattr__(self, name):
6272
+ return getattr(self.target, name)
6273
6274
+ class Config:
6275
+ def __getitem__(self, key):
6276
+ return ("view", key)
6277
6278
+ cfg = ConfigView(Config())
6279
+ self.assertEqual(cfg["x"], ("view", "x"))
6280
6281
6282
if __name__ == "__main__":
6283
unittest.main()
0 commit comments