2022-09-09 18:28:41 +00:00
|
|
|
from uvloop import _testbase as tb
|
|
|
|
from uvloop.loop import libuv_get_loop_t_ptr, libuv_get_version
|
2023-10-10 00:28:47 +00:00
|
|
|
from uvloop.loop import _testhelper_unwrap_capsuled_pointer as unwrap
|
2022-09-09 18:28:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Test_UV_libuv(tb.UVTestCase):
|
|
|
|
def test_libuv_get_loop_t_ptr(self):
|
2023-10-10 00:28:47 +00:00
|
|
|
loop1 = self.new_loop()
|
|
|
|
cap1 = libuv_get_loop_t_ptr(loop1)
|
|
|
|
cap2 = libuv_get_loop_t_ptr(loop1)
|
2022-09-09 18:28:41 +00:00
|
|
|
|
2023-10-10 00:28:47 +00:00
|
|
|
loop2 = self.new_loop()
|
|
|
|
cap3 = libuv_get_loop_t_ptr(loop2)
|
2022-09-09 18:28:41 +00:00
|
|
|
|
2023-10-10 00:28:47 +00:00
|
|
|
try:
|
|
|
|
self.assertEqual(unwrap(cap1), unwrap(cap2))
|
|
|
|
self.assertNotEqual(unwrap(cap1), unwrap(cap3))
|
|
|
|
finally:
|
|
|
|
loop1.close()
|
|
|
|
loop2.close()
|
2022-09-09 18:28:41 +00:00
|
|
|
|
|
|
|
def test_libuv_get_version(self):
|
|
|
|
self.assertGreater(libuv_get_version(), 0)
|