diff --git a/pyap/source_US/data.py b/pyap/source_US/data.py index 1a2f898..7f22090 100644 --- a/pyap/source_US/data.py +++ b/pyap/source_US/data.py @@ -907,18 +907,22 @@ def street_type_list_to_regex(street_type_list): """ po_box = r""" + (?: + [Pp]\.?\ ?[Oo]\.?\ ? + | + [Pp][Oo][Ss][Tt]\ [Oo][Ff][Ff][Ii][Cc][Ee]\ ? + )? (?: (?: (?: - [Pp]\.?\ ?[Oo]\.?\ ? + [Bb][Oo][Xx] | - [Pp][Oo][Ss][Tt]\ [Oo][Ff][Ff][Ii][Cc][Ee]\ ? - )? - [Bb][Oo][Xx] - | - [Pp][Mm][Bb] + [Pp][Mm][Bb] + ) + \ \#?\ ?A?\d+ ) - \ \#?\ ?A?\d+ + | + (?:[Dd][Rr][Aa][Ww][Ee][Rr]\ +[A-Z]\b) ) """ diff --git a/tests/test_parser.py b/tests/test_parser.py index 7e37e26..38bcc68 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -186,6 +186,19 @@ def test_combine_results(): "postal_code": "94583-2176", }, ), + ( + "2006 Broadway Ave Suite 2A, PO Drawer J, Great Bend, KS 67530", + { + "street_number": "2006", + "street_type": "Ave", + "street_name": "Broadway", + "occupancy": "Suite 2A", + "city": "Great Bend", + "region1": "KS", + "po_box": "PO Drawer J", + "postal_code": "67530", + }, + ), ], ) def test_parse_address(input: str, expected): diff --git a/tests/test_parser_us.py b/tests/test_parser_us.py index fa32073..064069d 100644 --- a/tests/test_parser_us.py +++ b/tests/test_parser_us.py @@ -368,6 +368,7 @@ def test_occupancy(input, expected): ("PMB 29700", True), ("pmb #29700", True), ("PO Box # A3656", True), + ("PO Drawer J", True), # negative assertions ("po box108 ", False), ("PoBox53485 ", False), @@ -561,6 +562,7 @@ def test_full_street_positive(input, expected): ("1 MEGA CENTER, MegaCity, MICH.49423-9576", True), ("1300 E MOUNT GARFIELD ROAD, NORTON SHORES 49441", True), ("PO Box # A3656\nChicago, IL 60690", True), + ("2006 Broadway Ave Suite 2A, PO Drawer J, Great Bend, KS 67530", True), # negative assertions ("ONE HEALING CENTER LLC, 16444", False), ("85 STEEL REGULAR SHAFT - NE", False),