From d913fd2ab8fa70e56c0b75a3c5acafc5dec959ad Mon Sep 17 00:00:00 2001 From: AlexViquez Date: Mon, 25 May 2020 21:00:43 -0500 Subject: [PATCH] fix just clean correct way --- arcusd/arcusactions.py | 2 +- tests/test_arcusd.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/arcusd/arcusactions.py b/arcusd/arcusactions.py index b7ef4d9..244f769 100644 --- a/arcusd/arcusactions.py +++ b/arcusd/arcusactions.py @@ -29,7 +29,7 @@ def unit_to_cents(unit: float) -> int: def clean(value: str) -> str: - return re.sub(r'\D', '', value) + return re.sub(r'[\W_]+', '', value) def amount_to_unit(cents: int) -> float: diff --git a/tests/test_arcusd.py b/tests/test_arcusd.py index be5b089..18ac870 100644 --- a/tests/test_arcusd.py +++ b/tests/test_arcusd.py @@ -13,3 +13,4 @@ def test_clean_phone_number(): assert clean('(555) 555 5555') == '5555555555' assert clean('555-555') == '555555' assert clean('555?444') == '555444' + assert clean('-.-5544MMCCXX**''') == '5544MMCCXX'