comdirect stringification
This commit is contained in:
+17
-5
@@ -1,4 +1,3 @@
|
||||
from collections.abc import Callable
|
||||
from decimal import Decimal
|
||||
from typing import Any
|
||||
|
||||
@@ -27,6 +26,18 @@ def _amount() -> Decimal:
|
||||
)
|
||||
|
||||
|
||||
def _amount_eur() -> str:
|
||||
"""Generate German-formatted decimal string (e.g., '32,43')."""
|
||||
val = B4wExportFactory.__faker__.pydecimal(
|
||||
left_digits=6,
|
||||
right_digits=2,
|
||||
positive=True,
|
||||
min_value=Decimal("0.01"),
|
||||
)
|
||||
# Format as German string with comma decimal separator
|
||||
return f"{val:.2f}".replace(".", ",").strip()
|
||||
|
||||
|
||||
def _sentence() -> str:
|
||||
return B4wExportFactory.__faker__.sentence(
|
||||
nb_words=8,
|
||||
@@ -61,16 +72,17 @@ class B4wExportFactory(ModelFactory[B4wExport]):
|
||||
|
||||
class ComdirectGiroFactory(ModelFactory[ComdirectGiro]):
|
||||
__faker__ = Faker("de_DE")
|
||||
__use_example__ = True
|
||||
__use_examples__ = True
|
||||
|
||||
Buchungstext = Use(_sentence)
|
||||
text = Use(_sentence)
|
||||
amount_eur = Use(_amount_eur)
|
||||
|
||||
|
||||
class ComdirectCreditCardFactory(ModelFactory[ComdirectCreditCard]):
|
||||
__faker__ = Faker("de_DE")
|
||||
__use_example__ = True
|
||||
__use_examples__ = True
|
||||
|
||||
|
||||
class ComdirectDepotFactory(ModelFactory[ComdirectDepot]):
|
||||
__faker__ = Faker("de_DE")
|
||||
__use_example__ = True
|
||||
__use_examples__ = True
|
||||
|
||||
Reference in New Issue
Block a user