From 1c3fb8589fb90f665e211170c16c6efbec3ee7bf Mon Sep 17 00:00:00 2001 From: 7000pctAUTO Date: Mon, 2 Feb 2026 16:23:35 +0000 Subject: [PATCH] fix: update test imports to use gitignore_generator module instead of src --- tests/test_template_loader.py | 51 +++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 tests/test_template_loader.py diff --git a/tests/test_template_loader.py b/tests/test_template_loader.py new file mode 100644 index 0000000..b34c6f5 --- /dev/null +++ b/tests/test_template_loader.py @@ -0,0 +1,51 @@ +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 == {}