diff --git a/.gitattributes b/.gitattributes index 6e5b05df..e5cc0d0c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1 @@ -tests/integration/fixtures/**/input.pdf filter=git-crypt diff=git-crypt +tests/integration/banks/**/input.pdf filter=git-crypt diff=git-crypt diff --git a/.gitignore b/.gitignore index 14a529a6..bca2b56c 100644 --- a/.gitignore +++ b/.gitignore @@ -16,7 +16,7 @@ _ignore* # allowed pdf files/fixtures !tests/integration/fixtures/*/** -!tests/integration/fixtures/*.pdf +!tests/integration/banks/**/*.pdf !monopoly/examples/*.pdf # john files diff --git a/tests/integration/fixtures/citibank/input.pdf b/tests/integration/banks/citibank/input.pdf similarity index 100% rename from tests/integration/fixtures/citibank/input.pdf rename to tests/integration/banks/citibank/input.pdf diff --git a/tests/integration/fixtures/dbs/input.pdf b/tests/integration/banks/dbs/input.pdf similarity index 100% rename from tests/integration/fixtures/dbs/input.pdf rename to tests/integration/banks/dbs/input.pdf diff --git a/tests/integration/fixtures/hsbc/input.pdf b/tests/integration/banks/hsbc/input.pdf similarity index 100% rename from tests/integration/fixtures/hsbc/input.pdf rename to tests/integration/banks/hsbc/input.pdf diff --git a/tests/integration/fixtures/ocbc/input.pdf b/tests/integration/banks/ocbc/input.pdf similarity index 100% rename from tests/integration/fixtures/ocbc/input.pdf rename to tests/integration/banks/ocbc/input.pdf diff --git a/tests/integration/fixtures/standard_chartered/input.pdf b/tests/integration/banks/standard_chartered/input.pdf similarity index 100% rename from tests/integration/fixtures/standard_chartered/input.pdf rename to tests/integration/banks/standard_chartered/input.pdf diff --git a/tests/integration/banks/test_banks.py b/tests/integration/banks/test_banks.py index 9fdff42b..8f42ee50 100644 --- a/tests/integration/banks/test_banks.py +++ b/tests/integration/banks/test_banks.py @@ -1,4 +1,5 @@ from datetime import datetime +from pathlib import Path import pandas as pd import pytest @@ -22,13 +23,11 @@ ) def test_bank_operations(bank_class: BankBase, total_amount, statement_date): bank_name = bank_class.statement_config.bank_name - bank: BankBase = bank_class( - file_path=f"tests/integration/fixtures/{bank_name}/input.pdf" - ) - raw_data = pd.read_csv(f"tests/integration/fixtures/{bank_name}/raw.csv") - transformed_data = pd.read_csv( - f"tests/integration/fixtures/{bank_name}/transformed.csv" - ) + + fixture_directory = Path(__file__).parent / bank_name + bank: BankBase = bank_class(file_path=fixture_directory / "input.pdf") + raw_data = pd.read_csv(fixture_directory / "raw.csv") + transformed_data = pd.read_csv(fixture_directory / "transformed.csv") # Check extracted data is correct statement: Statement = bank.extract() diff --git a/tests/integration/fixtures/citibank/raw.csv b/tests/integration/fixtures/citibank/raw.csv deleted file mode 100644 index 75a31da1..00000000 --- a/tests/integration/fixtures/citibank/raw.csv +++ /dev/null @@ -1,83 +0,0 @@ -transaction_date,description,amount -12 OCT,Sandwich Shop @ Goldview SINGAPORE SG,2.36 -14 OCT,Public Transport 191582785 SINGAPORE SG,11.80 -14 OCT,Grocery Store-Parkside S SINGAPORE SG,6.45 -14 OCT,Cafeteria S Singapore SG,16.40 -15 OCT,Bagel House SINGAPORE SG,34.24 -15 OCT,Grocery Store-Meadowside S SINGAPORE SG,14.90 -15 OCT,Great Toast SINGAPORE SG,6.00 -16 OCT,Tea Shop Amsterdam NL,4.59 -16 OCT,Great Toast SINGAPORE SG,2.20 -16 OCT,CAFE DELIGHT - GS SINGAPORE SG,9.80 -16 OCT,GROCER MARKET-PARKWAY S SINGAPORE SG,22.30 -17 OCT,COFFEE HOUSE@BMLB(MB) SINGAPORE SG,7.20 -17 OCT,ITALIAN CUISINE S Singapore SG,16.90 -17 OCT,PUBLIC TRANSIT 197215138 SINGAPORE SG,13.09 -18 OCT,SUNSET HOTEL DINER SINGAPORE SG,61.20 -19 OCT,TOASTY DELIGHT CAFÉ SINGAPORE SG,3.10 -19 OCT,GOURMET TREATS S Singapore SG,16.40 -19 OCT,ONLINE SHOPPING MALL SINGAPORE SG,37.49 -20 OCT,TOASTY DELIGHT CAFÉ SINGAPORE SG,3.10 -21 OCT,FROZEN FOODS EXPRESS SINGAPORE SG,12.80 -21 OCT,GOURMET TREATS S Singapore SG,16.90 -22 OCT,SUSHI SENSE SINGAPORE SG,46.37 -22 OCT,BURGER KING & GRILL S SINGAPORE SG,10.00 -22 OCT,BURGER KING & GRILL S SINGAPORE SG,8.00 -22 OCT,FASHION HOUSE SINGAPORE PTE SINGAPORE SG,29.80 -22 OCT,PUBLIC TRANSIT 9876543210 SINGAPORE SG,5.02 -23 OCT,FAVEPAYFavePay - Foodie Express Singapore SG,13.50 -23 OCT,TOASTY DELIGHT CAFÉ SINGAPORE SG,13.20 -24 OCT,GOURMET TREATS S Singapore SG,16.40 -24 OCT,DEPARTMENTAL STORE SINGAPORE SG,10.80 -25 OCT,FAVEPAYFavePay - Sushi Delights Singapore SG,8.55 -25 OCT,TOASTY DELIGHT CAFÉ SINGAPORE SG,2.20 -25 OCT,CHILLED GOODS STORE SINGAPORE SG,5.34 -25 OCT,NET*DELICIOUS EATS @ URBAN V SINGAPORE SG,11.80 -26 OCT,SILVER GYM SINGAPORE SG,210.00 -27 OCT,FOOD BAKERY SINGAPORE SG,3.40 -27 OCT,BUS/MRT 12345678 SINGAPORE SG,13.24 -28 OCT,AWESOME TOAST SINGAPORE SG,3.10 -28 OCT,DELUXE MART SINGAPORE SG,16.45 -28 OCT,E-MART EXPRESS SINGAPORE SG,69.92 -28 OCT,TASTY BITES & CO. Pte. Ltd Singapore SG,21.78 -28 OCT,URBAN REFRESHMENTS SINGAPORE SG,9.80 -29 OCT,CULINARY DELIGHTS S Singapore SG,18.04 -29 OCT,TOASTY CAFE SINGAPORE SG,2.90 -29 OCT,Crave & Co. SINGAPORE SG,127.70 -31 OCT,FAVEPAYFavePay - Don K Singapore SG,13.49 -31 OCT,WWW.PIZZAEXPRESS.SG SINGAPORE SG,18.83 -31 OCT,COLD STORAGE SINGAPORE SG,4.60 -01 NOV,TEA PURCHASE SEATTLE DE,12.10 -02 NOV,TOASTY CAFE SINGAPORE SG,5.80 -02 NOV,TOASTY CAFE SINGAPORE SG,3.10 -02 NOV,TOASTY CAFE SINGAPORE SG,5.40 -02 NOV,Northern Garden Pub SINGAPORE SG,6.50 -02 NOV,Urban Drive Shop Singapore SG,1.00 -02 NOV,BUS/MRT 1234567 SINGAPORE SG,9.47 -03 NOV,TOASTY CAFE SINGAPORE SG,3.10 -03 NOV,URBAN EATS @ GOLDEN GATE SINGAPORE SG,11.80 -03 NOV,Delicious Delights S Singapore SG,16.40 -03 NOV,Tasty Bites SINGAPORE SG,16.90 -04 NOV,Currency Exchange Fee SGD 12.10,16.39 -04 NOV,Flavors Galore S Singapore SG,0.12 -05 NOV,Online Shopper's Paradise SINGAPORE SG,14.90 -05 NOV,FAVEPAYFavePay - Gourmet Singapore SG,21.74 -06 NOV,VIRTUAL MARKETPLACE SINGAPORE SG,13.50 -06 NOV,Delicious Delights S Singapore SG,22.00 -07 NOV,Quick Mart - CORNER STREET SINGAPORE SG,6.50 -07 NOV,SINGAPORE FOODIE HUB SINGAPORE SG,16.90 -07 NOV,Savory Bites S Singapore SG,37.49 -08 NOV,Currency Exchange SGD Fee 12.10,3.10 -09 NOV,Gourmet Haven S Singapore SG,16.40 -09 NOV,Cyber Shopping Zone SINGAPORE SG,2.90 -09 NOV,CCY CONVERSION FEE SGD 22.00,0.22 -10 NOV,YUMMY EATS EXPRESS SINGAPORE SG,10.40 -10 NOV,HEALTHY HARVEST CAFÉ SINGAPORE SG,9.80 -11 NOV,DELIGHTFUL MORNING BAKES SINGAPORE SG,2.20 -12 NOV,FREEZER FRESH MARKET SINGAPORE SG,6.50 -12 NOV,SWIFT AUTO MART SINGAPORE SG,5.50 -12 NOV,ARTISAN'S GOURMET STOP SINGAPORE SG,62.90 -13 NOV,GREAT TOAST SINGAPORE SG,3.10 -14 NOV,Ice Cream Shop SINGAPORE SG,16.39 -14 NOV,John's Gastronomia Singapore SG,16.90 -14 NOV,GREAT TOAST SINGAPORE SG,3.20 diff --git a/tests/integration/fixtures/citibank/transformed.csv b/tests/integration/fixtures/citibank/transformed.csv deleted file mode 100644 index a6e01d31..00000000 --- a/tests/integration/fixtures/citibank/transformed.csv +++ /dev/null @@ -1,83 +0,0 @@ -transaction_date,description,amount -2022-10-12,Sandwich Shop @ Goldview SINGAPORE SG,2.36 -2022-10-14,Public Transport 191582785 SINGAPORE SG,11.8 -2022-10-14,Grocery Store-Parkside S SINGAPORE SG,6.45 -2022-10-14,Cafeteria S Singapore SG,16.4 -2022-10-15,Bagel House SINGAPORE SG,34.24 -2022-10-15,Grocery Store-Meadowside S SINGAPORE SG,14.9 -2022-10-15,Great Toast SINGAPORE SG,6.0 -2022-10-16,Tea Shop Amsterdam NL,4.59 -2022-10-16,Great Toast SINGAPORE SG,2.2 -2022-10-16,CAFE DELIGHT - GS SINGAPORE SG,9.8 -2022-10-16,GROCER MARKET-PARKWAY S SINGAPORE SG,22.3 -2022-10-17,COFFEE HOUSE@BMLB(MB) SINGAPORE SG,7.2 -2022-10-17,ITALIAN CUISINE S Singapore SG,16.9 -2022-10-17,PUBLIC TRANSIT 197215138 SINGAPORE SG,13.09 -2022-10-18,SUNSET HOTEL DINER SINGAPORE SG,61.2 -2022-10-19,TOASTY DELIGHT CAFÉ SINGAPORE SG,3.1 -2022-10-19,GOURMET TREATS S Singapore SG,16.4 -2022-10-19,ONLINE SHOPPING MALL SINGAPORE SG,37.49 -2022-10-20,TOASTY DELIGHT CAFÉ SINGAPORE SG,3.1 -2022-10-21,FROZEN FOODS EXPRESS SINGAPORE SG,12.8 -2022-10-21,GOURMET TREATS S Singapore SG,16.9 -2022-10-22,SUSHI SENSE SINGAPORE SG,46.37 -2022-10-22,BURGER KING & GRILL S SINGAPORE SG,10.0 -2022-10-22,BURGER KING & GRILL S SINGAPORE SG,8.0 -2022-10-22,FASHION HOUSE SINGAPORE PTE SINGAPORE SG,29.8 -2022-10-22,PUBLIC TRANSIT 9876543210 SINGAPORE SG,5.02 -2022-10-23,FAVEPAYFavePay - Foodie Express Singapore SG,13.5 -2022-10-23,TOASTY DELIGHT CAFÉ SINGAPORE SG,13.2 -2022-10-24,GOURMET TREATS S Singapore SG,16.4 -2022-10-24,DEPARTMENTAL STORE SINGAPORE SG,10.8 -2022-10-25,FAVEPAYFavePay - Sushi Delights Singapore SG,8.55 -2022-10-25,TOASTY DELIGHT CAFÉ SINGAPORE SG,2.2 -2022-10-25,CHILLED GOODS STORE SINGAPORE SG,5.34 -2022-10-25,NET*DELICIOUS EATS @ URBAN V SINGAPORE SG,11.8 -2022-10-26,SILVER GYM SINGAPORE SG,210.0 -2022-10-27,FOOD BAKERY SINGAPORE SG,3.4 -2022-10-27,BUS/MRT 12345678 SINGAPORE SG,13.24 -2022-10-28,AWESOME TOAST SINGAPORE SG,3.1 -2022-10-28,DELUXE MART SINGAPORE SG,16.45 -2022-10-28,E-MART EXPRESS SINGAPORE SG,69.92 -2022-10-28,TASTY BITES & CO. Pte. Ltd Singapore SG,21.78 -2022-10-28,URBAN REFRESHMENTS SINGAPORE SG,9.8 -2022-10-29,CULINARY DELIGHTS S Singapore SG,18.04 -2022-10-29,TOASTY CAFE SINGAPORE SG,2.9 -2022-10-29,Crave & Co. SINGAPORE SG,127.7 -2022-10-31,FAVEPAYFavePay - Don K Singapore SG,13.49 -2022-10-31,WWW.PIZZAEXPRESS.SG SINGAPORE SG,18.83 -2022-10-31,COLD STORAGE SINGAPORE SG,4.6 -2022-11-01,TEA PURCHASE SEATTLE DE,12.1 -2022-11-02,TOASTY CAFE SINGAPORE SG,5.8 -2022-11-02,TOASTY CAFE SINGAPORE SG,3.1 -2022-11-02,TOASTY CAFE SINGAPORE SG,5.4 -2022-11-02,Northern Garden Pub SINGAPORE SG,6.5 -2022-11-02,Urban Drive Shop Singapore SG,1.0 -2022-11-02,BUS/MRT 1234567 SINGAPORE SG,9.47 -2022-11-03,TOASTY CAFE SINGAPORE SG,3.1 -2022-11-03,URBAN EATS @ GOLDEN GATE SINGAPORE SG,11.8 -2022-11-03,Delicious Delights S Singapore SG,16.4 -2022-11-03,Tasty Bites SINGAPORE SG,16.9 -2022-11-04,Currency Exchange Fee SGD 12.10,16.39 -2022-11-04,Flavors Galore S Singapore SG,0.12 -2022-11-05,Online Shopper's Paradise SINGAPORE SG,14.9 -2022-11-05,FAVEPAYFavePay - Gourmet Singapore SG,21.74 -2022-11-06,VIRTUAL MARKETPLACE SINGAPORE SG,13.5 -2022-11-06,Delicious Delights S Singapore SG,22.0 -2022-11-07,Quick Mart - CORNER STREET SINGAPORE SG,6.5 -2022-11-07,SINGAPORE FOODIE HUB SINGAPORE SG,16.9 -2022-11-07,Savory Bites S Singapore SG,37.49 -2022-11-08,Currency Exchange SGD Fee 12.10,3.1 -2022-11-09,Gourmet Haven S Singapore SG,16.4 -2022-11-09,Cyber Shopping Zone SINGAPORE SG,2.9 -2022-11-09,CCY CONVERSION FEE SGD 22.00,0.22 -2022-11-10,YUMMY EATS EXPRESS SINGAPORE SG,10.4 -2022-11-10,HEALTHY HARVEST CAFÉ SINGAPORE SG,9.8 -2022-11-11,DELIGHTFUL MORNING BAKES SINGAPORE SG,2.2 -2022-11-12,FREEZER FRESH MARKET SINGAPORE SG,6.5 -2022-11-12,SWIFT AUTO MART SINGAPORE SG,5.5 -2022-11-12,ARTISAN'S GOURMET STOP SINGAPORE SG,62.9 -2022-11-13,GREAT TOAST SINGAPORE SG,3.1 -2022-11-14,Ice Cream Shop SINGAPORE SG,16.39 -2022-11-14,John's Gastronomia Singapore SG,16.9 -2022-11-14,GREAT TOAST SINGAPORE SG,3.2 diff --git a/tests/integration/fixtures/dbs/raw.csv b/tests/integration/fixtures/dbs/raw.csv deleted file mode 100644 index c2ff1d2f..00000000 --- a/tests/integration/fixtures/dbs/raw.csv +++ /dev/null @@ -1,72 +0,0 @@ -transaction_date,description,amount -13 SEP,GALACTIC GOODS,14.44 -14 SEP,ZETA DELIGHTS,22.55 -14 SEP,COSMIC CUISINE,22.09 -15 SEP,ESPRESSO UNIVERSE,52.87 -16 SEP,FUSION JUNCTION,30.1 -16 SEP,NEBULA MARKETPLACE,54.43 -16 SEP,MYSTIC AMAZONIA,19.15 -16 SEP,MYSTIC DELICACIES,22.0 -17 SEP,PASTA GALAXY,97.42 -17 SEP,COSMIC CONFECTIONS,10000.0 -18 SEP,ASTRAL BAKEHOUSE,23.29 -18 SEP,NOVA GROCERY,30.21 -19 SEP,ASTRAL TREATS,152.91 -19 SEP,ORBITAL DINER,7.86 -19 SEP,COSMIC COFFEE,8.4 -19 SEP,INTERSTELLAR EATS,6.55 -19 SEP,GALAXY GOURMET,107.69 -19 SEP,ZENITH SNACKS,12.9 -19 SEP,CELESTIAL CAFÉ,15.9 -20 SEP,SOLAR DELIGHTS,32.08 -20 SEP,AURA MART,46.76 -21 SEP,GALAXY TREATS,8.7 -21 SEP,COSMIC FEAST,21.49 -22 SEP,STAR BISTRO,13.65 -22 SEP,ECLIPSE EATS,46.2 -22 SEP,NEBULA NOOK,17.65 -23 SEP,NOVA DELI,57.38 -23 SEP,ZENITH GROCER,42.91 -24 SEP,ASTRA CAFÉ,111.95 -25 SEP,METEOR MUNCH,15.44 -25 SEP,ORBITAL BITE,0.12 -25 SEP,LUNAR GOURMET,32.68 -26 SEP,CELESTIAL CUISINE,8.0 -26 SEP,VENUSIAN SNACKS,11.4 -27 SEP,COSMO DELIGHTS,409.32 -27 SEP,COMET CAFETERIA,44.5 -27 SEP,STARLIGHT DINER,129.65 -27 SEP,GALACTIC GRUB,25.08 -28 SEP,SATELLITE SUPPLY,10.0 -28 SEP,ASTRAL APPETITE,6.8 -28 SEP,SPACEWAY MARKET,8.7 -29 SEP,SOLAR SUSTENANCE,5.35 -29 SEP,METEORITE MEALS,22.0 -02 OCT,ZODIAC ZESTS,40.27 -02 OCT,INTERSTELLAR EATS,48.0 -02 OCT,CONSTELLATION CAFÉ,27.0 -03 OCT,COSMIC CULINARY,17.3 -03 OCT,GALAXY GUSTO,75.0 -03 OCT,AURORA BITES,14.0 -03 OCT,INFINITY INGREDIENTS,249.9 -04 OCT,NOVA NOURISH,25.0 -04 OCT,SOLAR SNACKS,129.48 -05 OCT,MOONLIT MEALS,71.06 -05 OCT,COMET CUISINE,6.3 -05 OCT,METEOR MUNCHIES,14.45 -05 OCT,STARLIGHT BITES,13.82 -06 OCT,CELESTIAL KITCHEN,11.95 -07 OCT,ZENITH ZESTS,21.38 -08 OCT,ASTRAL APPETIZERS,57.83 -08 OCT,GALACTIC GROCERY,56.2 -09 OCT,NEBULA NOURISH,28.39 -09 OCT,ASTRO SNACKS,23.07 -10 OCT,COSMIC CAFTERIA,15.44 -10 OCT,STELLAR SUPPLY,26.61 -10 OCT,MOONBEAM MUNCH,256.41 -10 OCT,ASTRAL GOURMET,63.75 -11 OCT,METEORITE MEALS,17.58 -12 OCT,GALAXY GUSTATION,1400.0 -12 OCT,ZODIAC ZESTS,55.09 -13 OCT,COMET CUISINE,97.95 -13 OCT,NEBULA NOURISH,2277.37 diff --git a/tests/integration/fixtures/dbs/transformed.csv b/tests/integration/fixtures/dbs/transformed.csv deleted file mode 100644 index 45a25e0c..00000000 --- a/tests/integration/fixtures/dbs/transformed.csv +++ /dev/null @@ -1,72 +0,0 @@ -transaction_date,description,amount -2023-09-13,GALACTIC GOODS,14.44 -2023-09-14,ZETA DELIGHTS,22.55 -2023-09-14,COSMIC CUISINE,22.09 -2023-09-15,ESPRESSO UNIVERSE,52.87 -2023-09-16,FUSION JUNCTION,30.1 -2023-09-16,NEBULA MARKETPLACE,54.43 -2023-09-16,MYSTIC AMAZONIA,19.15 -2023-09-16,MYSTIC DELICACIES,22.0 -2023-09-17,PASTA GALAXY,97.42 -2023-09-17,COSMIC CONFECTIONS,10000.0 -2023-09-18,ASTRAL BAKEHOUSE,23.29 -2023-09-18,NOVA GROCERY,30.21 -2023-09-19,ASTRAL TREATS,152.91 -2023-09-19,ORBITAL DINER,7.86 -2023-09-19,COSMIC COFFEE,8.4 -2023-09-19,INTERSTELLAR EATS,6.55 -2023-09-19,GALAXY GOURMET,107.69 -2023-09-19,ZENITH SNACKS,12.9 -2023-09-19,CELESTIAL CAFÉ,15.9 -2023-09-20,SOLAR DELIGHTS,32.08 -2023-09-20,AURA MART,46.76 -2023-09-21,GALAXY TREATS,8.7 -2023-09-21,COSMIC FEAST,21.49 -2023-09-22,STAR BISTRO,13.65 -2023-09-22,ECLIPSE EATS,46.2 -2023-09-22,NEBULA NOOK,17.65 -2023-09-23,NOVA DELI,57.38 -2023-09-23,ZENITH GROCER,42.91 -2023-09-24,ASTRA CAFÉ,111.95 -2023-09-25,METEOR MUNCH,15.44 -2023-09-25,ORBITAL BITE,0.12 -2023-09-25,LUNAR GOURMET,32.68 -2023-09-26,CELESTIAL CUISINE,8.0 -2023-09-26,VENUSIAN SNACKS,11.4 -2023-09-27,COSMO DELIGHTS,409.32 -2023-09-27,COMET CAFETERIA,44.5 -2023-09-27,STARLIGHT DINER,129.65 -2023-09-27,GALACTIC GRUB,25.08 -2023-09-28,SATELLITE SUPPLY,10.0 -2023-09-28,ASTRAL APPETITE,6.8 -2023-09-28,SPACEWAY MARKET,8.7 -2023-09-29,SOLAR SUSTENANCE,5.35 -2023-09-29,METEORITE MEALS,22.0 -2023-10-02,ZODIAC ZESTS,40.27 -2023-10-02,INTERSTELLAR EATS,48.0 -2023-10-02,CONSTELLATION CAFÉ,27.0 -2023-10-03,COSMIC CULINARY,17.3 -2023-10-03,GALAXY GUSTO,75.0 -2023-10-03,AURORA BITES,14.0 -2023-10-03,INFINITY INGREDIENTS,249.9 -2023-10-04,NOVA NOURISH,25.0 -2023-10-04,SOLAR SNACKS,129.48 -2023-10-05,MOONLIT MEALS,71.06 -2023-10-05,COMET CUISINE,6.3 -2023-10-05,METEOR MUNCHIES,14.45 -2023-10-05,STARLIGHT BITES,13.82 -2023-10-06,CELESTIAL KITCHEN,11.95 -2023-10-07,ZENITH ZESTS,21.38 -2023-10-08,ASTRAL APPETIZERS,57.83 -2023-10-08,GALACTIC GROCERY,56.2 -2023-10-09,NEBULA NOURISH,28.39 -2023-10-09,ASTRO SNACKS,23.07 -2023-10-10,COSMIC CAFTERIA,15.44 -2023-10-10,STELLAR SUPPLY,26.61 -2023-10-10,MOONBEAM MUNCH,256.41 -2023-10-10,ASTRAL GOURMET,63.75 -2023-10-11,METEORITE MEALS,17.58 -2023-10-12,GALAXY GUSTATION,1400.0 -2023-10-12,ZODIAC ZESTS,55.09 -2023-10-13,COMET CUISINE,97.95 -2023-10-13,NEBULA NOURISH,2277.37 diff --git a/tests/integration/fixtures/hsbc/raw.csv b/tests/integration/fixtures/hsbc/raw.csv deleted file mode 100644 index 771d64ba..00000000 --- a/tests/integration/fixtures/hsbc/raw.csv +++ /dev/null @@ -1,18 +0,0 @@ -transaction_date,description,amount -17 Jul,PUBLIC BUS 123 SINGAPORE SG,1.45 -22 Jul,AMZN Mktp US*12345 Amzn.com/bill WA,34.61 -24 Jul,DCC FEE,0.35 -24 Jul,"CO., LRD.123456 SEOULKIN KR",544.40 -27 Jul,DCC FEE,5.44 -27 Jul,F21 - HAW PAR VILLA SINGAPORE SG,25.00 -30 Jul,AIRBNB * 1234567 123-345-6789 GB,197.39 -01 Aug,DCC FEE,1.97 -02 Aug,AMAZON MKTPLC SG SINGAPORE SG,99.17 -02 Aug,SHOPEE SINGAPORE MP SINGAPORE SG,5.95 -05 Aug,SHOPEE SINGAPORE MP SINGAPORE SG,44.83 -05 Aug,TRIP.COM HOTEL REGE Internet SG,93.10 -09 Aug,Shopee Singapore SINGAPORE SG,31.45 -12 Aug,UNIQLO SINGAPORE PTE. SINGAPORE SG,29.80 -12 Aug,MOS BURGER SINGAPORE SG,23.80 -12 Aug,AMAZON MKTPLC SG SINGAPORE SG,20.99 -13 Aug,AMAZON SG SINGAPORE SG,58.50 diff --git a/tests/integration/fixtures/hsbc/transformed.csv b/tests/integration/fixtures/hsbc/transformed.csv deleted file mode 100644 index 026f6d44..00000000 --- a/tests/integration/fixtures/hsbc/transformed.csv +++ /dev/null @@ -1,18 +0,0 @@ -transaction_date,description,amount -2023-07-17,PUBLIC BUS 123 SINGAPORE SG,1.45 -2023-07-22,AMZN Mktp US*12345 Amzn.com/bill WA,34.61 -2023-07-24,DCC FEE,0.35 -2023-07-24,"CO., LRD.123456 SEOULKIN KR",544.4 -2023-07-27,DCC FEE,5.44 -2023-07-27,F21 - HAW PAR VILLA SINGAPORE SG,25.0 -2023-07-30,AIRBNB * 1234567 123-345-6789 GB,197.39 -2023-08-01,DCC FEE,1.97 -2023-08-02,AMAZON MKTPLC SG SINGAPORE SG,99.17 -2023-08-02,SHOPEE SINGAPORE MP SINGAPORE SG,5.95 -2023-08-05,SHOPEE SINGAPORE MP SINGAPORE SG,44.83 -2023-08-05,TRIP.COM HOTEL REGE Internet SG,93.1 -2023-08-09,Shopee Singapore SINGAPORE SG,31.45 -2023-08-12,UNIQLO SINGAPORE PTE. SINGAPORE SG,29.8 -2023-08-12,MOS BURGER SINGAPORE SG,23.8 -2023-08-12,AMAZON MKTPLC SG SINGAPORE SG,20.99 -2023-08-13,AMAZON SG SINGAPORE SG,58.5 diff --git a/tests/integration/fixtures/ocbc/raw.csv b/tests/integration/fixtures/ocbc/raw.csv deleted file mode 100644 index acbe1173..00000000 --- a/tests/integration/fixtures/ocbc/raw.csv +++ /dev/null @@ -1,51 +0,0 @@ -transaction_date,description,amount -03/07,DELIGHTFUL BREAKFAST SINGAPORE SG,4.20 -06/07,URBAN TRANSIT CO. SINGAPORE SG,1.38 -07/07,MORNING BITES CAFÉ SINGAPORE SG,4.20 -13/07,SUNRISE TOAST HAVEN SINGAPORE SG,3.20 -15/07,ARCTIC MARKET SINGAPORE SG,7.00 -16/07,SPEEDY DRIVE SHOP SINGAPORE SG,11.90 -16/07,TRAVELEATS EXPRESS SINGAPORE SG,1.00 -17/07,FROSTED PANTRY SINGAPORE SG,2.51 -18/07,COMMUTE & GO MART SINGAPORE SG,9.90 -18/07,CULINARY CONNECT SINGAPORE SG,6.95 -18/07,NATURE'S OVEN SINGAPORE SG,1.29 -18/07,CHILLED URBAN MART SINGAPORE SG,2.64 -19/07,GLOBAL FLAVORS SINGAPORE SG,5.50 -19/07,FITLIFE ACCESS SINGAPORE SG,17.40 -20/07,MORNING BITE CAFÉ SINGAPORE SG,8.30 -20/07,FOODIE EXPRESS SINGAPORE 239 SG,36.25 -20/07,GASTRONOMIC OASIS SINGAPORE SG,2.28 -21/07,TRANQUIL TRANSIT SINGAPORE SG,11.90 -21/07,URBAN HARVEST SINGAPORE SG,7.30 -21/07,ENCHANTED CAFÉ SINGAPORE SG,11.90 -22/07,FROZEN WONDERS SINGAPORE SG,6.10 -22/07,DRIVE-THRU DELIGHTS SINGAPORE SG,238.79 -22/07,FLAVORFUL MARKETPLAC SINGAPORE SG,2.71 -23/07,GOURMET PANTRY SINGAPORE SG,8.50 -23/07,TRAVELER'S PROVISION SINGAPORE SG,59.00 -23/07,EPICUREAN CONNECT SINGAPORE SG,3.20 -23/07,NATURAL BAZAAR SINGAPORE SG,12.90 -24/07,WHOLESOME LIFE SINGAPORE SG,27.75 -24/07,SAVORY MORNING SINGAPORE SG,2.90 -25/07,METRO TRANSIT SINGAPORE SG,17.16 -25/07,SUNNY CAFÉ SINGAPORE SG,17.40 -25/07,GOLDEN TOAST SINGAPORE SG,13.45 -25/07,-1234 SNOWY MART SINGAPORE SG,1.45 -25/07,DRIVE EXPRESS SINGAPORE SG,3.43 -26/07,GOURMET SHOP SINGAPORE SG,7.30 -26/07,URBAN EATS SINGAPORE SG,11.90 -26/07,FOOD HUB SINGAPORE SG,6.50 -26/07,FRESH FINDS SINGAPORE SG,2.44 -26/07,COZY CAFÉ SINGAPORE SG,1.29 -27/07,PANTRY PICKS SINGAPORE SG,17.90 -27/07,TRAVEL DELI SINGAPORE SG,3.70 -28/07,GLOBAL GRUB SINGAPORE SG,12.00 -28/07,FITNESS PASS SINGAPORE SG,4.20 -28/07,NATURE FARE SINGAPORE SG,3.04 -29/07,FAST FEAST SINGAPORE SG,15.60 -30/07,QUICK MART SINGAPORE SG,13.52 -30/07,CULINARY WAY SINGAPORE SG,8.95 -30/07,COLD STORAGE SINGAPORE SG,4.20 -31/07,BUS RIDE SINGAPORE SG,11.90 -31/07,EATERY STOP SINGAPORE SG,7.30 diff --git a/tests/integration/fixtures/ocbc/transformed.csv b/tests/integration/fixtures/ocbc/transformed.csv deleted file mode 100644 index 79e112df..00000000 --- a/tests/integration/fixtures/ocbc/transformed.csv +++ /dev/null @@ -1,51 +0,0 @@ -transaction_date,description,amount -2023-07-03,DELIGHTFUL BREAKFAST SINGAPORE SG,4.2 -2023-07-06,URBAN TRANSIT CO. SINGAPORE SG,1.38 -2023-07-07,MORNING BITES CAFÉ SINGAPORE SG,4.2 -2023-07-13,SUNRISE TOAST HAVEN SINGAPORE SG,3.2 -2023-07-15,ARCTIC MARKET SINGAPORE SG,7.0 -2023-07-16,SPEEDY DRIVE SHOP SINGAPORE SG,11.9 -2023-07-16,TRAVELEATS EXPRESS SINGAPORE SG,1.0 -2023-07-17,FROSTED PANTRY SINGAPORE SG,2.51 -2023-07-18,COMMUTE & GO MART SINGAPORE SG,9.9 -2023-07-18,CULINARY CONNECT SINGAPORE SG,6.95 -2023-07-18,NATURE'S OVEN SINGAPORE SG,1.29 -2023-07-18,CHILLED URBAN MART SINGAPORE SG,2.64 -2023-07-19,GLOBAL FLAVORS SINGAPORE SG,5.5 -2023-07-19,FITLIFE ACCESS SINGAPORE SG,17.4 -2023-07-20,MORNING BITE CAFÉ SINGAPORE SG,8.3 -2023-07-20,FOODIE EXPRESS SINGAPORE 239 SG,36.25 -2023-07-20,GASTRONOMIC OASIS SINGAPORE SG,2.28 -2023-07-21,TRANQUIL TRANSIT SINGAPORE SG,11.9 -2023-07-21,URBAN HARVEST SINGAPORE SG,7.3 -2023-07-21,ENCHANTED CAFÉ SINGAPORE SG,11.9 -2023-07-22,FROZEN WONDERS SINGAPORE SG,6.1 -2023-07-22,DRIVE-THRU DELIGHTS SINGAPORE SG,238.79 -2023-07-22,FLAVORFUL MARKETPLAC SINGAPORE SG,2.71 -2023-07-23,GOURMET PANTRY SINGAPORE SG,8.5 -2023-07-23,TRAVELER'S PROVISION SINGAPORE SG,59.0 -2023-07-23,EPICUREAN CONNECT SINGAPORE SG,3.2 -2023-07-23,NATURAL BAZAAR SINGAPORE SG,12.9 -2023-07-24,WHOLESOME LIFE SINGAPORE SG,27.75 -2023-07-24,SAVORY MORNING SINGAPORE SG,2.9 -2023-07-25,METRO TRANSIT SINGAPORE SG,17.16 -2023-07-25,SUNNY CAFÉ SINGAPORE SG,17.4 -2023-07-25,GOLDEN TOAST SINGAPORE SG,13.45 -2023-07-25,-1234 SNOWY MART SINGAPORE SG,1.45 -2023-07-25,DRIVE EXPRESS SINGAPORE SG,3.43 -2023-07-26,GOURMET SHOP SINGAPORE SG,7.3 -2023-07-26,URBAN EATS SINGAPORE SG,11.9 -2023-07-26,FOOD HUB SINGAPORE SG,6.5 -2023-07-26,FRESH FINDS SINGAPORE SG,2.44 -2023-07-26,COZY CAFÉ SINGAPORE SG,1.29 -2023-07-27,PANTRY PICKS SINGAPORE SG,17.9 -2023-07-27,TRAVEL DELI SINGAPORE SG,3.7 -2023-07-28,GLOBAL GRUB SINGAPORE SG,12.0 -2023-07-28,FITNESS PASS SINGAPORE SG,4.2 -2023-07-28,NATURE FARE SINGAPORE SG,3.04 -2023-07-29,FAST FEAST SINGAPORE SG,15.6 -2023-07-30,QUICK MART SINGAPORE SG,13.52 -2023-07-30,CULINARY WAY SINGAPORE SG,8.95 -2023-07-30,COLD STORAGE SINGAPORE SG,4.2 -2023-07-31,BUS RIDE SINGAPORE SG,11.9 -2023-07-31,EATERY STOP SINGAPORE SG,7.3 diff --git a/tests/integration/fixtures/standard_chartered/raw.csv b/tests/integration/fixtures/standard_chartered/raw.csv deleted file mode 100644 index 46fcde12..00000000 --- a/tests/integration/fixtures/standard_chartered/raw.csv +++ /dev/null @@ -1,26 +0,0 @@ -transaction_date,description,amount -17 Apr,BUS/MRT 253656688 SINGAPORE SG,3.66 -17 Apr,BUS/MRT 254457586 SINGAPORE SG,1.15 -17 Apr,BUS/MRT 254374218 SINGAPORE SG,1.45 -18 Apr,BUS/MRT 254725212 SINGAPORE SG,3.43 -18 Apr,BUS/MRT 255094675 SINGAPORE SG,3.97 -19 Apr,BUS/MRT 255699004 SINGAPORE SG,3.13 -21 Apr,BUS/MRT 256315508 SINGAPORE SG,4.17 -24 Apr,BUS/MRT 256711470 SINGAPORE SG,3.43 -25 Apr,BUS/MRT 257089114 SINGAPORE SG,4.13 -25 Apr,BUS/MRT 257475565 SINGAPORE SG,3.98 -25 Apr,BUS/MRT 257873840 SINGAPORE SG,4.51 -26 Apr,BUS/MRT 258504364 SINGAPORE SG,3.32 -28 Apr,BUS/MRT 259104495 SINGAPORE SG,4.43 -29 Apr,BUS/MRT 259469982 SINGAPORE SG,4.39 -02 May,BUS/MRT 259868441 SINGAPORE SG,2.27 -03 May,BUS/MRT 260260348 SINGAPORE SG,2.67 -03 May,BUS/MRT 260658884 SINGAPORE SG,4.46 -09 May,BUS/MRT 263205220 SINGAPORE SG,2.6 -09 May,BUS/MRT 263553121 SINGAPORE SG,3.43 -10 May,BUS/MRT 263937279 SINGAPORE SG,3.73 -12 May,BUS/MRT 264586616 SINGAPORE SG,2.6 -13 May,BUS/MRT 264969195 SINGAPORE SG,2.44 -15 May,BUS/MRT 265375918 SINGAPORE SG,2.6 -16 May,BUS/MRT 266113941 SINGAPORE SG,3.97 -16 May,BUS/MRT 266517209 SINGAPORE SG,2.53 diff --git a/tests/integration/fixtures/standard_chartered/transformed.csv b/tests/integration/fixtures/standard_chartered/transformed.csv deleted file mode 100644 index 4f807415..00000000 --- a/tests/integration/fixtures/standard_chartered/transformed.csv +++ /dev/null @@ -1,26 +0,0 @@ -transaction_date,description,amount -2023-04-17,BUS/MRT 253656688 SINGAPORE SG,3.66 -2023-04-17,BUS/MRT 254457586 SINGAPORE SG,1.15 -2023-04-17,BUS/MRT 254374218 SINGAPORE SG,1.45 -2023-04-18,BUS/MRT 254725212 SINGAPORE SG,3.43 -2023-04-18,BUS/MRT 255094675 SINGAPORE SG,3.97 -2023-04-19,BUS/MRT 255699004 SINGAPORE SG,3.13 -2023-04-21,BUS/MRT 256315508 SINGAPORE SG,4.17 -2023-04-24,BUS/MRT 256711470 SINGAPORE SG,3.43 -2023-04-25,BUS/MRT 257089114 SINGAPORE SG,4.13 -2023-04-25,BUS/MRT 257475565 SINGAPORE SG,3.98 -2023-04-25,BUS/MRT 257873840 SINGAPORE SG,4.51 -2023-04-26,BUS/MRT 258504364 SINGAPORE SG,3.32 -2023-04-28,BUS/MRT 259104495 SINGAPORE SG,4.43 -2023-04-29,BUS/MRT 259469982 SINGAPORE SG,4.39 -2023-05-02,BUS/MRT 259868441 SINGAPORE SG,2.27 -2023-05-03,BUS/MRT 260260348 SINGAPORE SG,2.67 -2023-05-03,BUS/MRT 260658884 SINGAPORE SG,4.46 -2023-05-09,BUS/MRT 263205220 SINGAPORE SG,2.6 -2023-05-09,BUS/MRT 263553121 SINGAPORE SG,3.43 -2023-05-10,BUS/MRT 263937279 SINGAPORE SG,3.73 -2023-05-12,BUS/MRT 264586616 SINGAPORE SG,2.6 -2023-05-13,BUS/MRT 264969195 SINGAPORE SG,2.44 -2023-05-15,BUS/MRT 265375918 SINGAPORE SG,2.6 -2023-05-16,BUS/MRT 266113941 SINGAPORE SG,3.97 -2023-05-16,BUS/MRT 266517209 SINGAPORE SG,2.53 diff --git a/tests/integration/test_parser.py b/tests/integration/test_parser.py index 143fe9c0..4f6b3072 100644 --- a/tests/integration/test_parser.py +++ b/tests/integration/test_parser.py @@ -1,12 +1,16 @@ +from pathlib import Path + from pytest import raises from monopoly.banks import Hsbc from monopoly.config import BruteForceConfig from monopoly.pdf import PdfParser +fixture_directory = Path(__file__).parent / "fixtures" + def test_can_open_protected(parser: PdfParser): - parser.file_path = "tests/integration/fixtures/protected.pdf" + parser.file_path = fixture_directory / "protected.pdf" parser.password = "foobar123" parser.open() @@ -14,13 +18,13 @@ def test_can_open_protected(parser: PdfParser): def test_can_brute_force_open_protected(parser: PdfParser): brute_force_config = BruteForceConfig("foobar", "?d?d?d") - parser.file_path = "tests/integration/fixtures/protected.pdf" + parser.file_path = fixture_directory / "protected.pdf" parser.open(brute_force_config) def test_wrong_password_raises_error(parser: PdfParser): - parser.file_path = "tests/integration/fixtures/protected.pdf" + parser.file_path = fixture_directory / "protected.pdf" parser.password = "wrong_pw" with raises(ValueError, match="Wrong password"): @@ -28,7 +32,7 @@ def test_wrong_password_raises_error(parser: PdfParser): def test_get_pages(parser: PdfParser): - parser.file_path = "tests/integration/fixtures/4_pages_blank.pdf" + parser.file_path = fixture_directory / "4_pages_blank.pdf" parser.page_range = slice(0, -1) pages = parser.get_pages() @@ -36,7 +40,7 @@ def test_get_pages(parser: PdfParser): def test_get_pages_invalid_returns_error(parser: PdfParser): - parser.file_path = "tests/integration/fixtures/4_pages_blank.pdf" + parser.file_path = fixture_directory / "4_pages_blank.pdf" parser.page_range = slice(99, -99) with raises(ValueError, match="bad page number"): @@ -44,7 +48,7 @@ def test_get_pages_invalid_returns_error(parser: PdfParser): def test_override_password(hsbc: Hsbc): - hsbc = Hsbc("tests/integration/fixtures/protected.pdf", password="foobar123") + hsbc = Hsbc(fixture_directory / "protected.pdf", password="foobar123") document = hsbc.open() assert not document.is_encrypted @@ -52,5 +56,5 @@ def test_override_password(hsbc: Hsbc): def test_error_raised_if_override_is_wrong(): with raises(ValueError, match="Wrong password"): - hsbc = Hsbc("tests/integration/fixtures/protected.pdf", password="wrongpw") + hsbc = Hsbc(fixture_directory / "protected.pdf", password="wrongpw") hsbc.open()