From 7dda52786bffe5a73a442dc5876aa218d3dcfb12 Mon Sep 17 00:00:00 2001 From: Ali Faraji Date: Fri, 8 Jul 2022 02:48:42 +0430 Subject: [PATCH] Tests for Bankruptcy CEA #3 --- gamekit/algorithms/__init__.py | 4 +++- gamekit/algorithms/bankruptcy.py | 4 ++-- gamekit/exceptions.py | 2 -- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gamekit/algorithms/__init__.py b/gamekit/algorithms/__init__.py index 4f8f2aa..0808a46 100644 --- a/gamekit/algorithms/__init__.py +++ b/gamekit/algorithms/__init__.py @@ -1,3 +1,5 @@ -from gamekit.algorithms import * +from gamekit.algorithms.bankruptcy import * + + diff --git a/gamekit/algorithms/bankruptcy.py b/gamekit/algorithms/bankruptcy.py index fdb1a6f..b210ffb 100644 --- a/gamekit/algorithms/bankruptcy.py +++ b/gamekit/algorithms/bankruptcy.py @@ -19,7 +19,7 @@ def constrained_equal_awards(claims: list, asset: float) -> tuple[list, float]: asset (float): total amount of our assets (non-negative) Returns: list: list of allocations - r: the r value in the $a_i = min(r, c_i) $ (if sum of claims become less than asset, then the r-value would be the asset itself.) + r: the r value in the $a_i = min(r, c_i) $ (if sum of claims become less than asset, then the r-value would be the largest claim value.) """ # checks @@ -30,7 +30,7 @@ def constrained_equal_awards(claims: list, asset: float) -> tuple[list, float]: raise NegativeNumberException("Asset cannot be a negative number.") if sum(claims) <= asset: - return claims, asset + return claims, max(claims) else: equal_alloc = asset/len(claims) diff --git a/gamekit/exceptions.py b/gamekit/exceptions.py index 7c7faba..1af7cbe 100644 --- a/gamekit/exceptions.py +++ b/gamekit/exceptions.py @@ -6,5 +6,3 @@ class NegativeNumberException(Exception): def __init__(self, message) -> None: self.message = message - def __init__(self) -> None: - pass