moved tests out of src, added more test cases

This commit is contained in:
2025-05-08 13:31:24 +02:00
parent 233f81c33e
commit 6a22ecb591
3 changed files with 30 additions and 24 deletions

0
tests/__init__.py Normal file
View File

30
tests/test_config.py Normal file
View File

@@ -0,0 +1,30 @@
import os
from typing import assert_type
import pytest
from src.config import Config
@pytest.fixture
def config() -> Config:
config = Config(path="testfiles", filename="configtest.ini")
return config
def teardown_config():
print("tearing down config test")
def test_construction(config):
assert_type(config, Config)
def test_file_creation(config):
config._save()
assert os.path.isfile(os.path.join(config.path, config.filename))
def test_add_section(config):
config.add_section("test_section")
assert "test_section" in config.parser.sections()
def test_set_and_get(config):
config.set(section="section", option="option", value="value")
assert config.get(section="section", option="option") == "value"