| # -*- coding: utf-8 -*- | |
| # SPDX-FileCopyrightText: 2016-2025 PyThaiNLP Project | |
| # SPDX-FileType: SOURCE | |
| # SPDX-License-Identifier: Apache-2.0 | |
| """ | |
| Unit test. | |
| Each file in tests/ is for each main package. | |
| """ | |
| from unittest import TestLoader, TestSuite | |
| # Names of module to be tested | |
| test_packages: list[str] = [ | |
| "tests.core", | |
| "tests.compact", | |
| ] | |
| def load_tests( | |
| loader: TestLoader, standard_tests: TestSuite, pattern: str | |
| ) -> TestSuite: | |
| """Load test protocol | |
| See: https://docs.python.org/3/library/unittest.html#id1 | |
| """ | |
| suite = TestSuite() | |
| for test_package in test_packages: | |
| tests = loader.loadTestsFromName(test_package) | |
| suite.addTests(tests) | |
| return suite | |
| if __name__ == "__main__": | |
| import unittest | |
| unittest.main() | |