diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2017-09-10 12:32:49 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2017-09-10 12:32:49 +0200 |
commit | 090a2703703877bd150aae637031c5d7dcba2df4 (patch) | |
tree | 3d498820503e1ab3c7186c2839a661a76083550b /test | |
parent | c96bc5755a68d8e317d96be31b330cc0b626c194 (diff) | |
download | ee-python-090a2703703877bd150aae637031c5d7dcba2df4.tar.gz ee-python-090a2703703877bd150aae637031c5d7dcba2df4.tar.bz2 ee-python-090a2703703877bd150aae637031c5d7dcba2df4.tar.xz ee-python-090a2703703877bd150aae637031c5d7dcba2df4.zip |
setup.py: Adding install_requires.
digikey: Updating tests. Making sure the directory exist before writing facts.
Stop recursing into new searches when a search returns multiple hits. Let the frontends do that.
Diffstat (limited to 'test')
-rw-r--r-- | test/test_digikey.py | 20 |
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 |