Files
clang-p2996/clang/bindings/python/tests/cindex/test_file.py
Jannick Kremer 71cfa381ef [libclang/python/tests] Clean up imports (#114409)
Sort imports using `isort`.
Remove unused imports.
Collect multiple imports from the same module into a single import
statement.
Unify import style.
2024-10-31 16:48:20 +00:00

19 lines
508 B
Python

import os
from clang.cindex import Config, File, Index
if "CLANG_LIBRARY_PATH" in os.environ:
Config.set_library_path(os.environ["CLANG_LIBRARY_PATH"])
import unittest
class TestFile(unittest.TestCase):
def test_file(self):
index = Index.create()
tu = index.parse("t.c", unsaved_files=[("t.c", "")])
file = File.from_name(tu, "t.c")
self.assertEqual(str(file), "t.c")
self.assertEqual(file.name, "t.c")
self.assertEqual(repr(file), "<File: t.c>")