diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2017-09-03 11:21:17 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2017-09-03 11:21:17 +0200 |
commit | d59fb211556cd9b5a2bc028c5cf8a37b891cbfb3 (patch) | |
tree | 000b6bde185b8ff79efff97a3a46e0628bac92d7 /test | |
parent | c895e6c051cfda77a22b31367cf5c0bbedce4249 (diff) | |
download | ee-python-d59fb211556cd9b5a2bc028c5cf8a37b891cbfb3.tar.gz ee-python-d59fb211556cd9b5a2bc028c5cf8a37b891cbfb3.tar.bz2 ee-python-d59fb211556cd9b5a2bc028c5cf8a37b891cbfb3.tar.xz ee-python-d59fb211556cd9b5a2bc028c5cf8a37b891cbfb3.zip |
o Adding tools to download facts about parts from Digi-Key.
Diffstat (limited to 'test')
-rw-r--r-- | test/test_digikey.py | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/test/test_digikey.py b/test/test_digikey.py index 148f56e..0b79777 100644 --- a/test/test_digikey.py +++ b/test/test_digikey.py @@ -1,16 +1,28 @@ -from ee.kicad.bom import * -from ee.kicad.bom.io import read_bom -import ee.kicad.bom_tool as bom_tool -import ee.kicad.bom_tool.predef as predef +import ee.digikey as dk import os.path -import pytest +import yaml +import sys basedir = os.path.dirname(os.path.abspath(__file__)) -@pytest.mark.skip(reason="disabled for now") -def test_digikey(): - print("") - bom = read_bom(basedir + '/../demo/kicad/bom/A64-OlinuXino_Rev_C.xml') - settings = bom_tool.Settings(suppliers = [predef.digikey]) - pd = bom_tool.to_panda(bom, settings, predef.digikeyCsvFormat(predef.digikey)) - print(pd.to_csv(index = False)) +digikey = dk.Digikey() +client = dk.DigikeyClient(digikey) + + +def test_digikey_1(): + p = client.search("TCR2LF18LM(CTTR-ND") + assert isinstance(p, dk.DigikeyProduct) + assert p.part_number == "TCR2LF18LM(CTTR-ND" + assert len(p.attributes) > 5 + x = p.to_yaml() + print(type(x)) + print("{}".format(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" |