import ee.digikey as dk import os.path import yaml import sys basedir = os.path.dirname(os.path.abspath(__file__)) digikey = dk.Digikey() client = dk.DigikeyClient(digikey, on_download=print) def test_digikey_1(): 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(str(x)) yaml.dump(x, sys.stdout) def test_digikey_2(): 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