def item_access(options):
mapping = options.constructor(<EOL>{<EOL>'<STR_LIT:foo>': '<STR_LIT:bar>',<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>six.u('<STR_LIT>'): '<STR_LIT>',<EOL><NUM_LIT:3>: '<STR_LIT>',<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': {'<STR_LIT>': '<STR_LIT>'},<EOL>'<STR_LIT>': b'<STR_LIT>',<EOL>'<STR_LIT>': ({'<STR_LIT:a>': '<STR_LIT:b>'}, '<STR_LIT:c>'),<EOL>'<STR_LIT:list>': [{'<STR_LIT:a>': '<STR_LIT:b>'}, {'<STR_LIT:c>': '<STR_LIT:d>'}],<EOL>}<EOL>)<EOL>assert_equals(mapping['<STR_LIT:foo>'], '<STR_LIT:bar>')<EOL>assert_equals(mapping.foo, '<STR_LIT:bar>')<EOL>assert_equals(mapping('<STR_LIT:foo>'), '<STR_LIT:bar>')<EOL>assert_equals(mapping.get('<STR_LIT:foo>'), '<STR_LIT:bar>')<EOL>assert_equals(mapping[<NUM_LIT:3>], '<STR_LIT>')<EOL>assert_raises(TypeError, getattr, mapping, <NUM_LIT:3>)<EOL>assert_equals(mapping(<NUM_LIT:3>), '<STR_LIT>')<EOL>assert_equals(mapping.get(<NUM_LIT:3>), '<STR_LIT>')<EOL>assert_equals(mapping[six.u('<STR_LIT>')], '<STR_LIT>')<EOL>if six.PY2:<EOL><INDENT>assert_raises(UnicodeEncodeError, getattr, mapping, six.u('<STR_LIT>'))<EOL><DEDENT>else:<EOL><INDENT>assert_raises(AttributeError, getattr, mapping, six.u('<STR_LIT>'))<EOL><DEDENT>assert_equals(mapping(six.u('<STR_LIT>')), '<STR_LIT>')<EOL>assert_equals(mapping.get(six.u('<STR_LIT>')), '<STR_LIT>')<EOL>assert_equals(mapping['<STR_LIT>'], '<STR_LIT>')<EOL>assert_raises(AttributeError, lambda: mapping._lorem)<EOL>assert_equals(mapping('<STR_LIT>'), '<STR_LIT>')<EOL>assert_equals(mapping.get('<STR_LIT>'), '<STR_LIT>')<EOL>assert_equals(mapping['<STR_LIT>'], '<STR_LIT>')<EOL>assert_not_equals(mapping.get, '<STR_LIT>')<EOL>assert_equals(mapping('<STR_LIT>'), '<STR_LIT>')<EOL>assert_equals(mapping.get('<STR_LIT>'), '<STR_LIT>')<EOL>assert_raises(AttributeError, lambda: mapping['<STR_LIT>'].alpha)<EOL>assert_equals(mapping.sub.alpha, '<STR_LIT>')<EOL>assert_equals(mapping('<STR_LIT>').alpha, '<STR_LIT>')<EOL>assert_raises(AttributeError, lambda: mapping.get('<STR_LIT>').alpha)<EOL>assert_equals(mapping['<STR_LIT>'], b'<STR_LIT>')<EOL>assert_equals(mapping.bytes, b'<STR_LIT>')<EOL>assert_equals(mapping('<STR_LIT>'), b'<STR_LIT>')<EOL>assert_equals(mapping.get('<STR_LIT>'), b'<STR_LIT>')<EOL>assert_equals(mapping['<STR_LIT>'], ({'<STR_LIT:a>': '<STR_LIT:b>'}, '<STR_LIT:c>'))<EOL>assert_equals(mapping.tuple, ({'<STR_LIT:a>': '<STR_LIT:b>'}, '<STR_LIT:c>'))<EOL>assert_equals(mapping('<STR_LIT>'), ({'<STR_LIT:a>': '<STR_LIT:b>'}, '<STR_LIT:c>'))<EOL>assert_equals(mapping.get('<STR_LIT>'), ({'<STR_LIT:a>': '<STR_LIT:b>'}, '<STR_LIT:c>'))<EOL>assert_raises(AttributeError, lambda: mapping['<STR_LIT>'][<NUM_LIT:0>].a)<EOL>assert_equals(mapping.tuple[<NUM_LIT:0>].a, '<STR_LIT:b>')<EOL>assert_equals(mapping('<STR_LIT>')[<NUM_LIT:0>].a, '<STR_LIT:b>')<EOL>assert_raises(AttributeError, lambda: mapping.get('<STR_LIT>')[<NUM_LIT:0>].a)<EOL>assert_true(isinstance(mapping['<STR_LIT>'], tuple))<EOL>assert_true(isinstance(mapping.tuple, tuple))<EOL>assert_true(isinstance(mapping('<STR_LIT>'), tuple))<EOL>assert_true(isinstance(mapping.get('<STR_LIT>'), tuple))<EOL>assert_true(isinstance(mapping['<STR_LIT>'][<NUM_LIT:0>], dict))<EOL>assert_true(isinstance(mapping.tuple[<NUM_LIT:0>], options.cls))<EOL>assert_true(isinstance(mapping('<STR_LIT>')[<NUM_LIT:0>], options.cls))<EOL>assert_true(isinstance(mapping.get('<STR_LIT>')[<NUM_LIT:0>], dict))<EOL>assert_true(isinstance(mapping['<STR_LIT>'][<NUM_LIT:1>], str))<EOL>assert_true(isinstance(mapping.tuple[<NUM_LIT:1>], str))<EOL>assert_true(isinstance(mapping('<STR_LIT>')[<NUM_LIT:1>], str))<EOL>assert_true(isinstance(mapping.get('<STR_LIT>')[<NUM_LIT:1>], str))<EOL>assert_equals(mapping['<STR_LIT:list>'], [{'<STR_LIT:a>': '<STR_LIT:b>'}, {'<STR_LIT:c>': '<STR_LIT:d>'}])<EOL>assert_equals(mapping.list, ({'<STR_LIT:a>': '<STR_LIT:b>'}, {'<STR_LIT:c>': '<STR_LIT:d>'}))<EOL>assert_equals(mapping('<STR_LIT:list>'), ({'<STR_LIT:a>': '<STR_LIT:b>'}, {'<STR_LIT:c>': '<STR_LIT:d>'}))<EOL>assert_equals(mapping.get('<STR_LIT:list>'), [{'<STR_LIT:a>': '<STR_LIT:b>'}, {'<STR_LIT:c>': '<STR_LIT:d>'}])<EOL>assert_raises(AttributeError, lambda: mapping['<STR_LIT:list>'][<NUM_LIT:0>].a)<EOL>assert_equals(mapping.list[<NUM_LIT:0>].a, '<STR_LIT:b>')<EOL>assert_equals(mapping('<STR_LIT:list>')[<NUM_LIT:0>].a, '<STR_LIT:b>')<EOL>assert_raises(AttributeError, lambda: mapping.get('<STR_LIT:list>')[<NUM_LIT:0>].a)<EOL>assert_true(isinstance(mapping['<STR_LIT:list>'], list))<EOL>assert_true(isinstance(mapping.list, tuple))<EOL>assert_true(isinstance(mapping('<STR_LIT:list>'), tuple))<EOL>assert_true(isinstance(mapping.get('<STR_LIT:list>'), list))<EOL>assert_true(isinstance(mapping['<STR_LIT:list>'][<NUM_LIT:0>], dict))<EOL>assert_true(isinstance(mapping.list[<NUM_LIT:0>], options.cls))<EOL>assert_true(isinstance(mapping('<STR_LIT:list>')[<NUM_LIT:0>], options.cls))<EOL>assert_true(isinstance(mapping.get('<STR_LIT:list>')[<NUM_LIT:0>], dict))<EOL>assert_true(isinstance(mapping['<STR_LIT:list>'][<NUM_LIT:1>], dict))<EOL>assert_true(isinstance(mapping.list[<NUM_LIT:1>], options.cls))<EOL>assert_true(isinstance(mapping('<STR_LIT:list>')[<NUM_LIT:1>], options.cls))<EOL>assert_true(isinstance(mapping.get('<STR_LIT:list>')[<NUM_LIT:1>], dict))<EOL>assert_raises(KeyError, lambda: mapping['<STR_LIT>'])<EOL>assert_raises(AttributeError, lambda: mapping.fake)<EOL>assert_raises(AttributeError, lambda: mapping('<STR_LIT>'))<EOL>assert_equals(mapping.get('<STR_LIT>'), None)<EOL>assert_equals(mapping.get('<STR_LIT>', '<STR_LIT>'), '<STR_LIT>')<EOL>
Access items in {cls}.