aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test_digikey.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/test/test_digikey.py b/test/test_digikey.py
index 6073e25..7509e2b 100644
--- a/test/test_digikey.py
+++ b/test/test_digikey.py
@@ -6,23 +6,23 @@ import sys
basedir = os.path.dirname(os.path.abspath(__file__))
digikey = dk.Digikey()
-client = dk.DigikeyClient(digikey)
+client = dk.DigikeyClient(digikey, on_download=print)
def test_digikey_1():
- p = client.search("TCR2LF18LM(CTTR-ND")
- assert isinstance(p, dk.DigikeyProduct)
+ res = client.search("TCR2LF18LM(CTTR-ND")
+ assert res.response_type == dk.SearchResponseTypes.SINGLE
+ p = res.products[0]
assert p.part_number == "TCR2LF18LM(CTTR-ND"
+ assert p.mpn == "TCR2LF18,LM(CT"
assert len(p.attributes) > 5
x = p.to_yaml()
- print(type(x))
- print("{}".format(x))
+ print(str(x))
yaml.dump(x, sys.stdout)
def test_digikey_2():
- response = client.search("TCR2LF")
- [print(p.part_id) for p in response.products]
- assert len(response.products) == 28
- # p = products[0]
- # assert p.part_number == "TCR2LF18LM(CTTR-ND"
+ res = client.search("TCR2LF", page_size=500)
+ assert res.response_type == dk.SearchResponseTypes.MANY
+ [print(p.part_number) for p in res.products]
+ assert len(res.products) == 28