aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2019-05-28 09:46:41 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2019-05-28 09:46:41 +0200
commit2e2956823c9cd02c766b296cbcbea9130bd07b36 (patch)
tree29be58764f33374cd768a5151182d1a2aa75b041 /test
parentd108963a31f726ec8e1f471695addbbabb0db312 (diff)
downloadee-python-2e2956823c9cd02c766b296cbcbea9130bd07b36.tar.gz
ee-python-2e2956823c9cd02c766b296cbcbea9130bd07b36.tar.bz2
ee-python-2e2956823c9cd02c766b296cbcbea9130bd07b36.tar.xz
ee-python-2e2956823c9cd02c766b296cbcbea9130bd07b36.zip
digikey: Better search when getting multiple results back. Instead of
doing a new search with the selected digikey part number, do a direct lookup with the product's URL instead. This ensures that we always get a match and don't get confused when multiple part numbers are returned.
Diffstat (limited to 'test')
-rw-r--r--test/test_digikey.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/test_digikey.py b/test/test_digikey.py
index 528ed8e..f1b010b 100644
--- a/test/test_digikey.py
+++ b/test/test_digikey.py
@@ -21,7 +21,7 @@ force_refresh = False # Set to True to always fetch the updated html files
def test_digikey_1(tmpdir):
content = client.search("TCR2LF18LM(CTTR-ND")
- res = parser.parse_string(content)
+ res = parser.parse_string(client.baseurl, content)
assert res.response_type == dk.SearchResponseTypes.SINGLE
p = res.products[0]
assert p.part_number == "TCR2LF18LM(CTTR-ND"
@@ -50,7 +50,7 @@ def test_digikey_1(tmpdir):
def test_digikey_2():
content = client.product_search("TCR2LF", page_size=500)
- res = parser.parse_string(content)
+ res = parser.parse_string(client.baseurl, content)
assert res.response_type == dk.SearchResponseTypes.MANY
[print("dpn={}, mpn={}".format(p.part_number, p.mpn)) for p in res.products]
assert len(res.products) > 10
@@ -64,7 +64,7 @@ def test_digikey_2():
content = client.product_search(dpn)
- res = parser.parse_string(content)
+ res = parser.parse_string(client.baseurl, content)
assert res.response_type == dk.SearchResponseTypes.SINGLE
p = res.products[0]
@@ -76,7 +76,7 @@ def test_digikey_2():
def test_digikey_3():
content = client.product_search("RS1MTR")
- res = parser.parse_string(content)
+ res = parser.parse_string(client.baseurl, content)
assert res.response_type == dk.SearchResponseTypes.MANY
[print("dpn={}, mpn={}".format(p.part_number, p.mpn)) for p in res.products]
assert len(res.products) > 0