Description:
detection/benford_engine.py computes chi-square, per-digit Z-scores, and MAD scores from a wallet's trade amounts. It's not clear from the existing test suite (tests/test_benford.py) what happens when the input trade list is empty (a brand-new wallet with zero trades in the current rolling window). This should return a well-defined neutral result rather than raising an unhandled exception or producing NaNs that silently propagate into the feature matrix.
Acceptance Criteria:
- A new test in
tests/test_benford.py calls the chi-square/Z-score/MAD functions with an empty amounts list.
- The test asserts either a documented sentinel value (e.g. 0.0 or None) is returned, or a specific, named exception is raised.
- If the current behavior is undesirable (raises a generic exception, returns NaN), the function is updated to handle the empty case explicitly and the test locks in the new behavior.
- Test passes under
make test.
Relevant files:
detection/benford_engine.py, tests/test_benford.py
Description:
detection/benford_engine.pycomputes chi-square, per-digit Z-scores, and MAD scores from a wallet's trade amounts. It's not clear from the existing test suite (tests/test_benford.py) what happens when the input trade list is empty (a brand-new wallet with zero trades in the current rolling window). This should return a well-defined neutral result rather than raising an unhandled exception or producing NaNs that silently propagate into the feature matrix.Acceptance Criteria:
tests/test_benford.pycalls the chi-square/Z-score/MAD functions with an empty amounts list.make test.Relevant files:
detection/benford_engine.py,tests/test_benford.py