switch to Claude Agent SDK
This commit is contained in:
1 parent
d023805bf1
commit
acd9163407
8 files changed
+612
-132
No files matched your search
+2
-2
@@ -3,7 +3,7 @@ from unittest.mock import MagicMock
|
||||
|
||||
import pytest
|
||||
|
||||
from catnab.ai import ItemClassification
|
||||
from catnab.ai import NamedClassification
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -102,7 +102,7 @@ def setup_mock_order(monkeypatch):
|
||||
def classify(item_names, _categories):
|
||||
result = {}
|
||||
for n in item_names:
|
||||
result[n] = ItemClassification(
|
||||
result[n] = NamedClassification(
|
||||
name=n,
|
||||
category=item_categories[n],
|
||||
description='',
|
||||
|
||||
+11
-3
@@ -2,7 +2,7 @@ import json
|
||||
|
||||
import pytest
|
||||
|
||||
import ai
|
||||
from catnab import ai
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
@@ -11,6 +11,10 @@ def test_classify_live():
|
||||
'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",
|
||||
'NOW Foods, Organic Xylitol, No Added Ingredients, 1 lb',
|
||||
'Leviton + 80601-W 1-Gang Decora/GFCI Device Wallplate + Midway Size + Thermoset + Device Mount + White',
|
||||
'Blackwood For Men Active Man Daily Conditioner for Normal to Oily Hair 17oz',
|
||||
'Boudreaux’s Butt Paste Maximum Strength Diaper Rash Cream, 4 Oz | Diaper Cream for Baby, Ointment With Zinc Oxide, Fast Relief, Overnight Protection, Moderate to Irritated Diaper Rash',
|
||||
]
|
||||
|
||||
categories = [
|
||||
@@ -56,11 +60,15 @@ def test_classify_live():
|
||||
]
|
||||
|
||||
res = ai.classify(item_names, categories)
|
||||
assert len(res) == 3
|
||||
assert len(res) == 7
|
||||
expected_categories = [
|
||||
'Semi-Essentials: Technology',
|
||||
'Semi-Essentials: Household Items',
|
||||
'Essentials: Clothes'
|
||||
'Essentials: Clothes',
|
||||
'Essentials: Groceries',
|
||||
'Long-term: Home Improvement',
|
||||
'Essentials: Toiletries and Hygiene',
|
||||
'Essentials: Baby',
|
||||
]
|
||||
for classified, ec in zip(res.values(), expected_categories):
|
||||
assert classified.category == ec
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import amazon
|
||||
from catnab import amazon
|
||||
|
||||
|
||||
def test_get_accounts():
|
||||
|
||||
+6
-6
@@ -4,7 +4,7 @@ from unittest.mock import MagicMock
|
||||
import pytest
|
||||
from ynab import TransactionFlagColor
|
||||
|
||||
from catnab.ai import ItemClassification
|
||||
from catnab.ai import NamedClassification
|
||||
import catnab
|
||||
from catnab import Context, TxCategory
|
||||
from catnab.amazon import AmazonAccount
|
||||
@@ -110,7 +110,7 @@ def test_get_tx_categories(monkeypatch):
|
||||
)
|
||||
|
||||
item_details={
|
||||
'An example item': ItemClassification(
|
||||
'An example item': NamedClassification(
|
||||
name='Example item',
|
||||
category='Example category',
|
||||
description='example',
|
||||
@@ -143,12 +143,12 @@ def test_get_categories_multi_items(monkeypatch):
|
||||
)
|
||||
|
||||
item_details={
|
||||
'An example item': ItemClassification(
|
||||
'An example item': NamedClassification(
|
||||
name='Example item 1',
|
||||
category='Example category',
|
||||
description='example',
|
||||
),
|
||||
'Another example': ItemClassification(
|
||||
'Another example': NamedClassification(
|
||||
name='Example item 2',
|
||||
category='Example category',
|
||||
description='second example',
|
||||
@@ -181,12 +181,12 @@ def test_get_categories_multi_categories(monkeypatch):
|
||||
)
|
||||
|
||||
item_details={
|
||||
'An example item': ItemClassification(
|
||||
'An example item': NamedClassification(
|
||||
name='Example item 1',
|
||||
category='Example category',
|
||||
description='example',
|
||||
),
|
||||
'Another example': ItemClassification(
|
||||
'Another example': NamedClassification(
|
||||
name='Example item 2',
|
||||
category='Other category',
|
||||
description='second example',
|
||||
|
||||
Reference in new issue
Block a user