# Path: app/src/main/python/chaquopy/test/static_proxy/basic.py
# class BasicAdder(static_proxy()):
# class GC(static_proxy()):
#     def __init__(self, n):
#     def add(self, x):
#     def __init__(self):
# 
# Path: app/src/main/python/chaquopy/test/test_utils.py
# class FilterWarningsCase(TestCase):
# 
#     def setUp(self):
#         super().setUp()
#         self.cw = catch_warnings()
#         self.cw.__enter__()
#         filterwarnings("error")
# 
#     def tearDown(self):
#         self.cw.__exit__(None, None, None)
#         super().tearDown()


from java import static_proxy
from .static_proxy import basic
from .test_utils import FilterWarningsCase
from com.chaquo.python import TestStaticProxy as TSP
            from com.chaquo.python.static_proxy import WrongLoadOrder  # noqa: F401
        from java.lang import Runnable
        from .pyobjecttest import DelTrigger as DT

    def test_basic(self):
        BA = basic.BasicAdder
        TSP.ba1, TSP.ba2 = BA(1), BA(2)
        self.assertEqual(5, TSP.ba1.add(4))
        self.assertEqual(6, TSP.ba2.add(4))

    # Could happen if static proxies aren't regenerated correctly.
    def test_wrong_load_order(self):
        with self.assertRaisesRegex(TypeError, "static_proxy class "
                                    "com.chaquo.python.static_proxy.WrongLoadOrder loaded "
                                    "before its Python counterpart"):

    # Could happen if static proxies aren't regenerated correctly.
    def test_wrong_bases(self):
        with self.assertRaisesRegex(TypeError, "expected extends java.lang.Object, but Java "
                                    "class actually extends java.lang.Exception"):
            class WrongExtends(static_proxy(package="com.chaquo.python.static_proxy")):
                pass

        with self.assertRaisesRegex(TypeError, r"expected implements \['java.lang.Runnable', "
                                    r"'com.chaquo.python.StaticProxy'], but Java class actually "
                                    r"implements \[]"):
            class WrongImplements(static_proxy(None, Runnable,
                                               package="com.chaquo.python.static_proxy")):
                pass

    def test_gc(self):

        DT.reset()

# Path: app/src/main/python/chaquopy/test/static_proxy/basic.py
# class BasicAdder(static_proxy()):
# class GC(static_proxy()):
#     def __init__(self, n):
#     def add(self, x):
#     def __init__(self):
# 
# Path: app/src/main/python/chaquopy/test/test_utils.py
# class FilterWarningsCase(TestCase):
# 
#     def setUp(self):
#         super().setUp()
#         self.cw = catch_warnings()
#         self.cw.__enter__()
#         filterwarnings("error")
# 
#     def tearDown(self):
#         self.cw.__exit__(None, None, None)
#         super().tearDown()


# Path: app/src/main/python/chaquopy/test/test_static_proxy.py
from java import static_proxy
from .static_proxy import basic
from .test_utils import FilterWarningsCase
from com.chaquo.python import TestStaticProxy as TSP
            from com.chaquo.python.static_proxy import WrongLoadOrder  # noqa: F401
        from java.lang import Runnable
        from .pyobjecttest import DelTrigger as DT


    def test_basic(self):
        BA = basic.BasicAdder
        TSP.ba1, TSP.ba2 = BA(1), BA(2)
        self.assertEqual(5, TSP.ba1.add(4))
        self.assertEqual(6, TSP.ba2.add(4))

    # Could happen if static proxies aren't regenerated correctly.
    def test_wrong_load_order(self):
        with self.assertRaisesRegex(TypeError, "static_proxy class "
                                    "com.chaquo.python.static_proxy.WrongLoadOrder loaded "
                                    "before its Python counterpart"):

    # Could happen if static proxies aren't regenerated correctly.
    def test_wrong_bases(self):
        with self.assertRaisesRegex(TypeError, "expected extends java.lang.Object, but Java "
                                    "class actually extends java.lang.Exception"):
            class WrongExtends(static_proxy(package="com.chaquo.python.static_proxy")):
                pass

        with self.assertRaisesRegex(TypeError, r"expected implements \['java.lang.Runnable', "
                                    r"'com.chaquo.python.StaticProxy'], but Java class actually "
                                    r"implements \[]"):
            class WrongImplements(static_proxy(None, Runnable,
                                               package="com.chaquo.python.static_proxy")):
                pass

    def test_gc(self):

        DT.reset()

        gc = basic.GC()