Debian Codegraph @

tests/test_python.py

raw
1 # Copyright (c) Meta Platforms, Inc. and affiliates.
2 # SPDX-License-Identifier: LGPL-2.1-or-later
3 import _drgn
4 import drgn
5 from tests import TestCase
6
7
8 class TestModule(TestCase):
9 def test_all(self):
10 # At least for now, everything in the Python library should go in
11 # __all__, so make sure that happens.
12 from_python = {
13 name
14 for name in dir(drgn)
15 if not name.startswith("_")
16 and getattr(getattr(drgn, name), "__module__", "").startswith("drgn")
17 }
18 self.assertEqual(from_python - set(drgn.__all__), set())
19
20 def test_bindings(self):
21 # Make sure everything in the C extension (_drgn) is added to the
22 # Python library (drgn).
23 from_extension = {name for name in dir(_drgn) if not name.startswith("_")}
24 self.assertEqual(from_extension - set(dir(drgn)), set())
25 self.assertEqual(from_extension - set(drgn.__all__), set())