# 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 support import BaseTest
from nolang.error import AppError
                def __init__(self, x) {
                    self.attr = x;
                }
            }

            def main() {
                let x;
                x = X(13);
                return x.attr;
            }
            """)
        assert self.space.int_w(w_res) == 13

    def test_class_attributes_illegal(self):
        try:
            self.interpret("""
            class X {
                let attr;

                def __init__(self, x) {
                    self.attr2 = x;
                }
            }

            def main() {
                let x;
                x = X(13);
                return x.attr2;
            }
            """)

# 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_classes.py
from support import BaseTest
from nolang.error import AppError

                def __init__(self, x) {
                    self.attr = x;
                }
            }

            def main() {
                let x;
                x = X(13);
                return x.attr;
            }
            """)
        assert self.space.int_w(w_res) == 13

    def test_class_attributes_illegal(self):
        try:
            self.interpret("""
            class X {
                let attr;

                def __init__(self, x) {
                    self.attr2 = x;
                }
            }

            def main() {
                let x;
                x = X(13);
                return x.attr2;
            }
            """)

        except AppError as e: