Skip to content

Farnell/element14 API tests do not work anymore #277

@the78mole

Description

@the78mole

Farnell seems to have changed at least one description of a tested item. I added some debug output to the code and this is what was output:

[INFO]  Downloading...https://api.element14.com/catalog/products?callInfo.responseDataFormat=JSON&resultsSettings.offset=0&resultsSettings.numberOfResults=1&resultsSettings.responseGroup=large&callInfo.apiKey=xxx&storeInfo.id=uk.farnell.com&term=manuPartNum:1N4148W-7-F
[INFO]          Expected: Small Signal Diode, Single, 100 V, 300 mA, 1.25 V, 4 ns, 2 A
[INFO]          Returned: DIODE, ULTRAFAST RECOVERY, 300mA, 75V, SOD-123-2, FULL REEL
[INFO]          Expected: DIODES INC.
[INFO]          Returned: MULTICOMP PRO
[INFO]          Expected: 1N4148W-7-F
[INFO]          Returned: 1N4148W-7-F.
[INFO]  Downloading...https://api.element14.com/catalog/products?callInfo.responseDataFormat=JSON&resultsSettings.offset=0&resultsSettings.numberOfResults=1&resultsSettings.responseGroup=large&callInfo.apiKey=xxx&storeInfo.id=www.newark.com&term=manuPartNum:BLM18AG601SN1D
[INFO]          Expected: Ferrite Bead, 0603 [1608 Metric], 600 ohm, 500 mA, EMIFIL BLM18AG Series, 0.38 ohm, ▒ 25%
[INFO]          Returned: Ferrite Bead, 0603 [1608 Metric], 600 ohm, 500 mA, EMIFIL BLM18AG Series, 0.38 ohm, ▒ 25%
[INFO]          Expected: MURATA
[INFO]          Returned: MURATA
[INFO]          Expected: BLM18AG601SN1D
[INFO]          Returned: BLM18AG601SN1D
[INFO]  Downloading...https://api.element14.com/catalog/products?callInfo.responseDataFormat=JSON&resultsSettings.offset=0&resultsSettings.numberOfResults=1&resultsSettings.responseGroup=large&callInfo.apiKey=xxx&storeInfo.id=au.element14.com&term=manuPartNum:2N7002K-T1-GE3
[INFO]          Expected: Power MOSFET, N Channel, 60 V, 190 mA, 2 ohm, SOT-23, Surface Mount
[INFO]          Returned: Power MOSFET, N Channel, 60 V, 190 mA, 2 ohm, SOT-23, Surface Mount
[INFO]          Expected: VISHAY
[INFO]          Returned: VISHAY
[INFO]          Expected: 2N7002K-T1-GE3
[INFO]          Returned: 2N7002K-T1-GE3

While the first comparision fails (and stops testing in current code), the two other tests would succeed.
I would suggest to test only for a valid return and not a byte-by-byte comparision in

if test_success:
for key, value in item['expected'].items():
if test_part[key] != value:
print(f'"{test_part[key]}" <> "{value}"')
test_success = False
break

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions