# 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()


import _thread
from java import detach, jclass
from time import time, sleep
from threading import Thread
from .test_utils import FilterWarningsCase
from com.chaquo.python import TestThread as JavaTestThread
from java.lang import String
            from java.lang import Integer



class TestThread(FilterWarningsCase):

    def test_gil_release_method(self):
        self.check_gil_release(JavaTestThread.BlockingMethods.blockStatic)
        self.check_gil_release(JavaTestThread.BlockingMethods().blockInstance)

    def test_gil_release_constructor(self):
        self.check_gil_release(JavaTestThread.BlockingConstructor)

    def check_gil_release(self, blocking_func):

# 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_thread.py
import _thread
from java import detach, jclass
from time import time, sleep
from threading import Thread
from .test_utils import FilterWarningsCase
from com.chaquo.python import TestThread as JavaTestThread
from java.lang import String
            from java.lang import Integer




class TestThread(FilterWarningsCase):

    def test_gil_release_method(self):
        self.check_gil_release(JavaTestThread.BlockingMethods.blockStatic)
        self.check_gil_release(JavaTestThread.BlockingMethods().blockInstance)

    def test_gil_release_constructor(self):
        self.check_gil_release(JavaTestThread.BlockingConstructor)

    def check_gil_release(self, blocking_func):

        self.assertFalse(JavaTestThread.blocked)