# Path: nolang/error.py
# class AppError(Exception):
#     def __init__(self, w_exception):
#         self.w_exception = w_exception
#         self.traceback = None
# 
#     def record_position(self, frame, bytecode, index):
#         self.traceback = TracebackElem(frame, index, bytecode, self.traceback)
# 
#     def match(self, space, w_expected):
#         return space.issubclass(space.type(self.w_exception), w_expected)
# 
#     def __repr__(self):
#         return '<AppError %r>' % (self.w_exception,)
#     __str__ = __repr__


from nolang.error import AppError
from support import BaseTest
        assert self.space.utf8_w(w_res) == "bar"

    def test_setitem(self):
        w_res = self.interpret_expr('''
            let x;
            x = {"a": "foo", 1: "bar"};
            x["c"] = "baz";
            return x;
        ''')
        space = self.space
        assert self.space.len(w_res) == 3
        assert space.utf8_w(space.getitem(w_res, space.newtext("c"))) == "baz"

    def test_in(self):
        w_res = self.interpret_expr('return "a" in {"a": 0, "b": 1};')
        assert w_res is self.space.w_True
        w_res = self.interpret_expr('return "b" in {"a": 0, "b": 1};')
        assert w_res is self.space.w_True
        w_res = self.interpret_expr('return "c" in {"a": 0, "b": 1};')
        assert w_res is self.space.w_False

    def test_not_in(self):
        w_res = self.interpret_expr('return "c" not in {"a": 0, "b": 1};')
        assert w_res is self.space.w_True
        w_res = self.interpret_expr('return "a" not in {"a": 0, "b": 1};')
        assert w_res is self.space.w_False

    def test_getitem_missing(self):
        try:
            self.interpret_expr('return {"foo": "bar"}["baz"];')

# Path: nolang/error.py
# class AppError(Exception):
#     def __init__(self, w_exception):
#         self.w_exception = w_exception
#         self.traceback = None
# 
#     def record_position(self, frame, bytecode, index):
#         self.traceback = TracebackElem(frame, index, bytecode, self.traceback)
# 
#     def match(self, space, w_expected):
#         return space.issubclass(space.type(self.w_exception), w_expected)
# 
#     def __repr__(self):
#         return '<AppError %r>' % (self.w_exception,)
#     __str__ = __repr__


# Path: tests/test_dict.py
from nolang.error import AppError
from support import BaseTest

        assert self.space.utf8_w(w_res) == "bar"

    def test_setitem(self):
        w_res = self.interpret_expr('''
            let x;
            x = {"a": "foo", 1: "bar"};
            x["c"] = "baz";
            return x;
        ''')
        space = self.space
        assert self.space.len(w_res) == 3
        assert space.utf8_w(space.getitem(w_res, space.newtext("c"))) == "baz"

    def test_in(self):
        w_res = self.interpret_expr('return "a" in {"a": 0, "b": 1};')
        assert w_res is self.space.w_True
        w_res = self.interpret_expr('return "b" in {"a": 0, "b": 1};')
        assert w_res is self.space.w_True
        w_res = self.interpret_expr('return "c" in {"a": 0, "b": 1};')
        assert w_res is self.space.w_False

    def test_not_in(self):
        w_res = self.interpret_expr('return "c" not in {"a": 0, "b": 1};')
        assert w_res is self.space.w_True
        w_res = self.interpret_expr('return "a" not in {"a": 0, "b": 1};')
        assert w_res is self.space.w_False

    def test_getitem_missing(self):
        try:
            self.interpret_expr('return {"foo": "bar"}["baz"];')

        except AppError as ae: