# Path: app/src/main/python/chaquopy/test/test_utils.py
# API_LEVEL = None
# 
# 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()


import copy
import pickle
from java import cast, jarray, jclass
from unittest import skipIf
from .test_utils import API_LEVEL, FilterWarningsCase
from com.chaquo.python import TestReflect as TR
from java.lang import Boolean, Object, String, System
    from .test_utils import assertDir
        from .test_utils import Object_names
        from com.chaquo.python import TestReflectKt as TRK

        # But calling an Object method through an interface cast should be done virtually.
        self.assertEqual("Child object", cast(TR.Interface, c).toString())

    def test_inheritance(self):
        Interface = self.nested_cls("Interface")
        SubInterface = self.nested_cls("SubInterface")
        Parent = self.nested_cls("Parent")
        Child = self.nested_cls("Child")

        self.assertEqual((object,), Object.__bases__)
        self.assertEqual((Object,), Interface.__bases__)
        self.assertEqual((Interface,), SubInterface.__bases__)
        self.assertEqual((Object,), Parent.__bases__)
        self.assertEqual((Parent, Interface), Child.__bases__)

        Interface_names = Object_names | {"iConstant", "iMethod"}
        Parent_names = Object_names | {"pStaticField", "pField", "pStaticMethod", "pMethod",
                                       "oStaticField", "oField", "oStaticMethod", "oMethod"}
        Child_names = Parent_names | Interface_names

        self.assertDir(Object, Object_names)
        self.assertDir(Interface, Interface_names)
        self.assertDir(Parent, Parent_names)
        self.assertDir(Child, Child_names)

        self.assertEqual("Interface constant", Child.iConstant)
        self.verify_field(Child, "pStaticField", "Parent static field")
        self.assertEqual("Parent static method", Child.pStaticMethod())
        self.verify_field(Child, "oStaticField", "Overridden static field")

# Path: app/src/main/python/chaquopy/test/test_utils.py
# API_LEVEL = None
# 
# 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_reflect.py
import copy
import pickle
from java import cast, jarray, jclass
from unittest import skipIf
from .test_utils import API_LEVEL, FilterWarningsCase
from com.chaquo.python import TestReflect as TR
from java.lang import Boolean, Object, String, System
    from .test_utils import assertDir
        from .test_utils import Object_names
        from com.chaquo.python import TestReflectKt as TRK


        # But calling an Object method through an interface cast should be done virtually.
        self.assertEqual("Child object", cast(TR.Interface, c).toString())

    def test_inheritance(self):
        Interface = self.nested_cls("Interface")
        SubInterface = self.nested_cls("SubInterface")
        Parent = self.nested_cls("Parent")
        Child = self.nested_cls("Child")

        self.assertEqual((object,), Object.__bases__)
        self.assertEqual((Object,), Interface.__bases__)
        self.assertEqual((Interface,), SubInterface.__bases__)
        self.assertEqual((Object,), Parent.__bases__)
        self.assertEqual((Parent, Interface), Child.__bases__)

        Interface_names = Object_names | {"iConstant", "iMethod"}
        Parent_names = Object_names | {"pStaticField", "pField", "pStaticMethod", "pMethod",
                                       "oStaticField", "oField", "oStaticMethod", "oMethod"}
        Child_names = Parent_names | Interface_names

        self.assertDir(Object, Object_names)
        self.assertDir(Interface, Interface_names)
        self.assertDir(Parent, Parent_names)
        self.assertDir(Child, Child_names)

        self.assertEqual("Interface constant", Child.iConstant)
        self.verify_field(Child, "pStaticField", "Parent static field")
        self.assertEqual("Parent static method", Child.pStaticMethod())
        self.verify_field(Child, "oStaticField", "Overridden static field")

        self.assertEqual("Overridden static method", Child.oStaticMethod())