Buckets:
| # Tests | |
| ## Overview | |
| This directory contains all test files for the CA10 Knowledge Graphs project. | |
| ## Running Tests | |
| ### Run All Tests | |
| ```bash | |
| cd tests | |
| python test_setup.py | |
| python test_api_keys.py | |
| ``` | |
| ### Run with pytest | |
| ```bash | |
| pytest test_*.py -v | |
| ``` | |
| ### Run Specific Test | |
| ```bash | |
| python test_setup.py | |
| ``` | |
| ## Test Files | |
| ### test_setup.py | |
| Tests the project setup and configuration: | |
| - Directory structure | |
| - Required files | |
| - Dependencies | |
| - Configuration files | |
| ### test_api_keys.py | |
| Tests API key configuration: | |
| - Environment variable loading | |
| - API key validation | |
| - Connection testing | |
| ## Writing Tests | |
| When adding new features, please add corresponding tests: | |
| ```python | |
| import unittest | |
| from src.core.knowledge_graph import KnowledgeGraph | |
| class TestKnowledgeGraph(unittest.TestCase): | |
| def setUp(self): | |
| self.kg = KnowledgeGraph() | |
| def test_add_entity(self): | |
| self.kg.add_entity("test_entity", "test_type") | |
| self.assertIn("test_entity", self.kg.entities) | |
| def test_add_relation(self): | |
| self.kg.add_relation("entity1", "relates_to", "entity2") | |
| self.assertEqual(len(self.kg.relations), 1) | |
| if __name__ == '__main__': | |
| unittest.main() | |
| ``` | |
| ## Test Coverage | |
| Run coverage analysis: | |
| ```bash | |
| pytest --cov=src tests/ | |
| ``` | |
| ## Continuous Integration | |
| Tests are automatically run on: | |
| - Pull requests | |
| - Commits to main branch | |
| - Scheduled daily runs | |
| --- | |
| **Note**: Make sure all tests pass before submitting pull requests. | |
Xet Storage Details
- Size:
- 1.48 kB
- Xet hash:
- bf7e9c59ae793fbfe9e4e921d57195251482676e1a5e7be8ad8df3fafff17185
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.