File: test_python.py

package info (click to toggle)
drgn 0.0.33-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,892 kB
  • sloc: python: 59,081; ansic: 51,400; awk: 423; makefile: 339; sh: 113
file content (25 lines) | stat: -rw-r--r-- 949 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Copyright (c) Meta Platforms, Inc. and affiliates.
# SPDX-License-Identifier: LGPL-2.1-or-later
import _drgn
import drgn
from tests import TestCase


class TestModule(TestCase):
    def test_all(self):
        # At least for now, everything in the Python library should go in
        # __all__, so make sure that happens.
        from_python = {
            name
            for name in dir(drgn)
            if not name.startswith("_")
            and getattr(getattr(drgn, name), "__module__", "").startswith("drgn")
        }
        self.assertEqual(from_python - set(drgn.__all__), set())

    def test_bindings(self):
        # Make sure everything in the C extension (_drgn) is added to the
        # Python library (drgn).
        from_extension = {name for name in dir(_drgn) if not name.startswith("_")}
        self.assertEqual(from_extension - set(dir(drgn)), set())
        self.assertEqual(from_extension - set(drgn.__all__), set())