78 lines
2.6 KiB
Python
78 lines
2.6 KiB
Python
import json
|
||
|
||
import pytest
|
||
|
||
import ai
|
||
|
||
|
||
@pytest.mark.skip
|
||
def test_classify_live():
|
||
item_names = [
|
||
'Syston Cable Technology Cat 6A+ Ethernet Network Cable,700MHz 23AWG Solid Bare Copper Wire Outdoor/Indoor, No Ends 100/250/500/1000 Ft Available, Heat Resistant Plenum Rated (100 FT, CMP, Blue-CMP)',
|
||
"Chef'n Salad Dressing Mixer, Baking White/Vintage Indigo",
|
||
"Lee Women's Ultra Lux Comfort with Flex Motion Skinny Leg Jean with Ever Fit, Black",
|
||
]
|
||
|
||
categories = [
|
||
'Home: Mortgage',
|
||
'Home: Property Tax',
|
||
'Home: Home Insurance',
|
||
'Home: Water',
|
||
'Home: Oil',
|
||
'Home: Other Utilities',
|
||
'Car: Car Insurance - Annual',
|
||
'Car: Car Insurance - Monthly',
|
||
'Car: Maintenance',
|
||
'Internal Master Category: Inflow: Ready to Assign',
|
||
'Internal Master Category: Deferred Income SubCategory',
|
||
'Internal Master Category: Uncategorized',
|
||
'Essentials: Groceries',
|
||
"Essentials: I'm Too Lazy To Cook",
|
||
'Essentials: Gas',
|
||
'Essentials: Clothes',
|
||
'Essentials: Baby',
|
||
'Essentials: Toiletries and Hygiene',
|
||
'Essentials: Medical',
|
||
'Essentials: Software Subscriptions',
|
||
'Essentials: Stuff I Forgot to Budget For',
|
||
'Essentials: Charity',
|
||
'Semi-Essentials: Sports and Fitness',
|
||
'Semi-Essentials: Gifts',
|
||
'Semi-Essentials: Technology',
|
||
'Semi-Essentials: Household Items',
|
||
'Semi-Essentials: Travel',
|
||
'Credit Card Payments: Citi Credit',
|
||
'Credit Card Payments: BoA Credit',
|
||
'Credit Card Payments: Amazon Credit',
|
||
"Credit Card Payments: BJ's Credit",
|
||
'Debt Payments: Student Loan',
|
||
'Just for Fun: Date Night',
|
||
'Just for Fun: Hobbies/Activities',
|
||
'Just for Fun: Doing Things With Friends',
|
||
'Just for Fun: Gaming',
|
||
'Just for Fun: Media',
|
||
'Long-term: Home Improvement',
|
||
'Long-term: The Future'
|
||
]
|
||
|
||
res = ai.classify(item_names, categories)
|
||
assert len(res) == 3
|
||
expected_categories = [
|
||
'Semi-Essentials: Technology',
|
||
'Semi-Essentials: Household Items',
|
||
'Essentials: Clothes'
|
||
]
|
||
for classified, ec in zip(res.values(), expected_categories):
|
||
assert classified.category == ec
|
||
|
||
|
||
@pytest.mark.skip
|
||
def test_classify_live_trouble():
|
||
with open('output/item_names.json') as f:
|
||
item_names = json.load(f)
|
||
with open('output/text_categories.json') as f:
|
||
text_categories = json.load(f)
|
||
|
||
res = ai.classify(item_names, text_categories)
|
||
assert set(item_names) ^ res.keys() == set()
|