from gitignore_generator.template_loader import template_loader, TemplateLoader class TestTemplateLoader: def test_get_available_templates(self): templates = template_loader.get_available_templates() assert len(templates) > 0 assert "python" in templates def test_get_available_templates_by_category(self): templates = template_loader.get_available_templates("languages") assert len(templates) > 0 assert "python" in templates def test_get_templates_by_category(self): by_cat = template_loader.get_templates_by_category() assert "languages" in by_cat assert "ides" in by_cat assert len(by_cat["languages"]) > 0 def test_get_template_content(self): content = template_loader.get_template_content("python") assert content is not None assert "__pycache__" in content def test_get_template_content_nonexistent(self): content = template_loader.get_template_content("nonexistent12345") assert content is None def test_template_exists(self): assert template_loader.template_exists("python") assert not template_loader.template_exists("nonexistent12345") def test_search_templates(self): results = template_loader.search_templates("python") assert len(results) > 0 assert "python" in results def test_search_templates_no_results(self): results = template_loader.search_templates("nonexistent12345") assert len(results) == 0 def test_merge_templates(self): merged = template_loader.merge_templates(["python", "vscode"]) assert "__pycache__" in merged assert ".vscode" in merged def test_init_template_loader(self): loader = TemplateLoader() assert loader._templates_index is None assert loader._custom_templates == {}