import pytest
import os.path
import ee.kicad.pcb

basedir = os.path.dirname(os.path.abspath(__file__))

def test_parsing():
    path = os.path.join(basedir, "kicad_pcb/parser-1.kicad_pcb")
    count = 0
    kicad_pcb = ee.kicad.pcb.parse(path)
    modules = kicad_pcb.modules
    del kicad_pcb.modules
    print(str(kicad_pcb))
    for m in modules:
        pads = m.pads
        del m.pads
        print(" {}".format(m))
        for p in pads:
            print("  {}".format(p))

    assert len(modules) == 4
    assert len(pads) == 2