aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ee/digikey/search_parts.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/ee/digikey/search_parts.py b/src/ee/digikey/search_parts.py
index 144b254..eace4e3 100644
--- a/src/ee/digikey/search_parts.py
+++ b/src/ee/digikey/search_parts.py
@@ -2,6 +2,7 @@ import functools
from pathlib import Path
from typing import List, MutableSet, Mapping
+from ee import EeException
from ee.db import ObjDb
from ee.digikey import Digikey, DigikeyParser, DigikeyClient, SearchResponseTypes, DigikeyProduct, DigikeyStore
from ee.part import PartDb, load_db, save_db, Part
@@ -92,6 +93,13 @@ class QueryEngine(object):
result = "exception"
elif response.response_type == SearchResponseTypes.SINGLE:
out_part = resolved(self.store.url, response.products[0])
+
+ out_pn = out_part.get_exactly_one_spn() if is_spn else out_part.get_exactly_one_mpn()
+ out_pn = out_pn.valueProp
+ if out_pn != pn:
+ raise EeException("Internal error: returned PN/SPN didn't match expected parts: "
+ "query: {} vs returned: {}".format(pn, out_pn))
+
result = "found"
elif response.response_type == SearchResponseTypes.MANY:
# TODO: order by spn/mpn so the output is consistent between runs.