summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--finance/income.py10
-rw-r--r--finance/test_income.py6
-rwxr-xr-xtools/check_source.sh1
3 files changed, 17 insertions, 0 deletions
diff --git a/finance/income.py b/finance/income.py
new file mode 100644
index 0000000..12d5d4e
--- /dev/null
+++ b/finance/income.py
@@ -0,0 +1,10 @@
+import dataclasses
+
+
+@dataclasses.dataclass(kw_only=True, frozen=True)
+class Income:
+
+ amount: float
+
+ def integrate(self, delta_t: int) -> float:
+ return delta_t * self.amount
diff --git a/finance/test_income.py b/finance/test_income.py
new file mode 100644
index 0000000..21d42f7
--- /dev/null
+++ b/finance/test_income.py
@@ -0,0 +1,6 @@
+from finance import income
+
+
+def test_income_integration() -> None:
+ inc = income.Income(amount=3000.0)
+ assert inc.integrate(5) == 15000.0
diff --git a/tools/check_source.sh b/tools/check_source.sh
index a401418..de8c790 100755
--- a/tools/check_source.sh
+++ b/tools/check_source.sh
@@ -12,3 +12,4 @@ root="$(dirname "$tools")"
black "$root"
mypy --strict "$root"
flake8 "$root"
+pytest "$root"