summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTorsten Marek <tmarek@google.com>2013-03-27 13:43:44 +0100
committerTorsten Marek <tmarek@google.com>2013-03-27 13:43:44 +0100
commitf8b6be5917502914ddff22b2635f39e4af0efae2 (patch)
tree0cae4eea80bee5e8e2e372158835ce51f6416b25 /test
parente7c5eff9d016058a57813069c5bac033ed611ab0 (diff)
downloadastroid-f8b6be5917502914ddff22b2635f39e4af0efae2.tar.gz
Add support for inference of subscript operations on dict literals. Closes #123074
actually fix Dict.getitem and enhance infer_subscript
Diffstat (limited to 'test')
-rw-r--r--test/unittest_inference.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/unittest_inference.py b/test/unittest_inference.py
index 3853e35..438ee26 100644
--- a/test/unittest_inference.py
+++ b/test/unittest_inference.py
@@ -627,6 +627,9 @@ b = (1, 2, 3)[1]
c = (1, 2, 3)[-1]
d = a + b + c
print (d)
+e = {'key': 'value'}
+f = e['key']
+print (f)
'''
astng = builder.string_build(code, __name__, __file__)
self.assertEqual([i.value for i in
@@ -637,6 +640,8 @@ print (d)
get_name_node(astng, 'c', -1).infer()], [3])
self.assertEqual([i.value for i in
get_name_node(astng, 'd', -1).infer()], [6])
+ self.assertEqual([i.value for i in
+ get_name_node(astng, 'f', -1).infer()], ['value'])
#def test_simple_tuple(self):
#"""test case for a simple tuple value"""