File: test_libuv_api.py

package info (click to toggle)
uvloop 0.21.0%2Bds1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 10,308 kB
  • sloc: python: 8,273; ansic: 108; makefile: 42
file content (23 lines) | stat: -rw-r--r-- 732 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from uvloop import _testbase as tb
from uvloop.loop import libuv_get_loop_t_ptr, libuv_get_version
from uvloop.loop import _testhelper_unwrap_capsuled_pointer as unwrap


class Test_UV_libuv(tb.UVTestCase):
    def test_libuv_get_loop_t_ptr(self):
        loop1 = self.new_loop()
        cap1 = libuv_get_loop_t_ptr(loop1)
        cap2 = libuv_get_loop_t_ptr(loop1)

        loop2 = self.new_loop()
        cap3 = libuv_get_loop_t_ptr(loop2)

        try:
            self.assertEqual(unwrap(cap1), unwrap(cap2))
            self.assertNotEqual(unwrap(cap1), unwrap(cap3))
        finally:
            loop1.close()
            loop2.close()

    def test_libuv_get_version(self):
        self.assertGreater(libuv_get_version(), 0)