mypy black ruff
This commit is contained in:
+21
-19
@@ -2,12 +2,7 @@
|
||||
|
||||
from datetime import date
|
||||
|
||||
import pytest
|
||||
|
||||
from src.domain_utils import set_category_budget, find_category_db
|
||||
from src.models.common import Sign, date2str, ExportBaseModel
|
||||
from src.models.category import Category, CategoryBudget, CategoryBudgetDb
|
||||
from src.models.b4w import B4wExport
|
||||
from src.models.common import ExportBaseModel, Sign, date2str
|
||||
|
||||
|
||||
class TestSignEnum:
|
||||
@@ -22,7 +17,7 @@ class TestSignEnum:
|
||||
"""Test Sign.__repr__ method (line 24)."""
|
||||
repr_debit = repr(Sign.DEBIT)
|
||||
assert repr_debit == "Sign.DEBIT"
|
||||
|
||||
|
||||
repr_credit = repr(Sign.CREDIT)
|
||||
assert repr_credit == "Sign.CREDIT"
|
||||
|
||||
@@ -68,64 +63,70 @@ class TestExportBaseModel:
|
||||
|
||||
def test_parameters_to_dict_empty(self):
|
||||
"""parameters_to_dict returns empty dict (line 70)."""
|
||||
|
||||
class TestModel(ExportBaseModel):
|
||||
pass
|
||||
|
||||
|
||||
model = TestModel()
|
||||
result = model.parameters_to_dict()
|
||||
assert result == {}
|
||||
|
||||
def test_parameters_to_str_no_params(self):
|
||||
"""parameters_to_str with no parameters."""
|
||||
|
||||
class TestModel(ExportBaseModel):
|
||||
pass
|
||||
|
||||
|
||||
model = TestModel()
|
||||
result = model.parameters_to_str()
|
||||
assert result == ""
|
||||
|
||||
def test_repr_empty_params(self):
|
||||
"""__repr__ with empty parameters (line 79)."""
|
||||
|
||||
class TestModel(ExportBaseModel):
|
||||
pass
|
||||
|
||||
|
||||
model = TestModel()
|
||||
|
||||
|
||||
# __repr__ should return string representation with empty params
|
||||
repr_result = repr(model)
|
||||
assert "TestModel" in repr_result
|
||||
|
||||
def test_str_empty_params(self):
|
||||
"""__str__ with empty parameters."""
|
||||
|
||||
class TestModel(ExportBaseModel):
|
||||
pass
|
||||
|
||||
|
||||
model = TestModel()
|
||||
|
||||
# __str__ should return string representation
|
||||
|
||||
# __str__ should return string representation
|
||||
str_result = str(model)
|
||||
assert "TestModel" in str_result
|
||||
|
||||
def test_repr_with_params(self):
|
||||
"""Test repr with actual parameters."""
|
||||
|
||||
class ConfigurableModel(ExportBaseModel):
|
||||
def parameters_to_dict(self) -> dict[str, str]:
|
||||
return {"key": "value"}
|
||||
|
||||
|
||||
model = ConfigurableModel()
|
||||
|
||||
|
||||
# Test that repr works correctly with params
|
||||
repr_result = repr(model)
|
||||
assert "key" in repr_result or "value" in repr_result
|
||||
|
||||
def test_str_with_params(self):
|
||||
"""Test str with actual parameters."""
|
||||
|
||||
class ConfigurableModel(ExportBaseModel):
|
||||
def parameters_to_dict(self) -> dict[str, str]:
|
||||
return {"name": "test"}
|
||||
|
||||
|
||||
model = ConfigurableModel()
|
||||
|
||||
|
||||
# Test that str works correctly with params
|
||||
str_result = str(model)
|
||||
assert "name" in str_result or "test" in str_result
|
||||
@@ -136,8 +137,9 @@ class TestMyNameMethod:
|
||||
|
||||
def test_my_name_returns_classname(self):
|
||||
"""_my_name should return the class name."""
|
||||
|
||||
class SubModel(ExportBaseModel):
|
||||
pass
|
||||
|
||||
|
||||
result = SubModel._my_name()
|
||||
assert result == "SubModel"
|
||||
|
||||
Reference in New Issue
Block a user